2 wrong answers in Count number of Binary

I read on forums that (n+2)th Fibonacci number will be the answer for n digits. I implemented it, but it gives 2 wrong answers. https://ide.codingblocks.com/s/142680

Hi @rishabhsetiya7,
Since the length of string can be maximum 90. You need to use long instead of int. And if the input is 89, in your System.out.print call, you need to print fibonacci[91] which won’t exist. Thus, the answer will come out to be 0.

Thank you sir :wink: It worked.