Not getting correct

first i tried the naive approach and got tle then i stored teh answer for smaller cases by memoization, i tried this on gfg and got all test cases correct but here i am getting it wrong, what the problem?

hi @paidaarpit1505_f9664148aad841e0,
https://ide.codingblocks.com/s/664323 updates

I had declared that array in global scope and initialize it to zero. so it means that statement didn’t initialize the array with all elements as zero?

@paidaarpit1505_f9664148aad841e0, yup seems so, but ideally it should as global array initializes all to zero

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.