Hackonacci Matrix Rotations

  • + 0 comments

    This can be solved in O(q) time, once you realize that the even/odd parity of the hackonacci(n) function is periodic, with a prime period.

    Print out the (Y/N) pattern of the Hackonacci Matrix for, say n=41 and see what I mean. It's easier to see if you use something like * and . instead of Y and N.

    This means you don't need a 2000x2000 array or carry around a huge memoization table for the hackonacci function.

    Hint: Do write up the slow, straightforward implementation of the problem statement to give yourself something to compare your optimized output to. The test cases here are pretty thin.