Ad
  • Custom User Avatar

    Both sequences would be [0, 5]. mu is 0 since the cycle starts at the 0th element, and the distance between repetition is 5. mu is not the value of the element that starts the cycle, but the index. Do not ignore x0. I'd recommend you complete the "Greedy Algorithm" kata before attempting this one, as it explains cycle detection terms in greater detail: http://www.codewars.com/kata/5416f1834c24604c46000696

    The integer division problem is irrelevant, since you're never going to be using the resulting number for anything other than equality and, e.g., 8 / 3 == 8 / 3 is always going to be true, even in JS.