Count Number of binary strings, TLE

Made a recursive approach to the problem. Among 3 test cases, it’s showing 1 correct and in other 2 TLE. I tried to solve the question using bit masking as well but it didnt worked. Help me out with this

the code is here https://pastebin.com/HWFLN9F7