If you list down the numbers, you’ll see a pattern. If current number is all 1s (say x times), the binary representation of next palindromic number will be is 1 + (x-1) times 0 + 1

In cases other than this, we just have to add 1 to (len-1)/2 th element, propagate carry to left, and mirror the result on right as well. Example, If currently we have 101101, the next number will be 110011, which we get by adding 1 to 2nd index and moving to left.

We can construct binary strings in this way, starting from 1.

# Another simpler approach

**choc**#1