Hi,
(Let's call the least significant element to be element number 0.)
For each element, starting with element number 0, you can calculate the number of sequences starting from there, that begin with a 0, and those that begin with a 1. Basically, `sequences_starting_with_zero[i] = sequences_starting_with_zero[i - 1] + sequences_starting_with_one[i - 1]`, and `sequences_starting_with_one[i] = sequences_starting_with_zero[i - 1]`. Do note that the starting condition is `sequences_starting_with_one[0] = ~~sequences_starting_with_zero[1] ~~sequences_starting_with_zero[0] = 1`.
Once you've such a table, calculating the `K`th sequence should be simple. For starters, if `K > sequences_starting_with_zero[N - 1] + sequences_starting_with_one[N - 1]`, then you can't form the required lexicographical order. If you can form one, then, in a loop starting from the most significant element, if `K > sequences_starting_with_zero[i]`, you output a `1`, subtract `sequences_starting_with_zero[i]`, and move further on. Else you output a `0`, and move further on.
Cheers!