• + 1 comment

    If you're having trouble with this question it is not your fault. idx should be = (x ^ lastAnswer) % n not just (x ^ lastAnswer) as stated in the problem. So annoying.