Back to the Problem
Collect remainders modulo 2 while halving, then output them in reverse.
Complexity: O(log N)