Https://ide.codingblocks.com/s/256642

only failing for last test case , showing run time error :, but why???

@Muskan-Gupta-598128740703036
Since N is very large. 1<= N < 100000000
you cannot create such a big array.
Try to do this question using O(1) space, (you just need two states)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.