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

please tell me y is my o/p giving such large values

Hey @kodivine0
Updated ur code and mentioned the changes in comment s:https://ide.codingblocks.com/s/340839

was it necessary to declare the dp array globally?

Nope ,but size of array was 200*200*200=6*10^6
So any array whose size is more than 10^6 we create that globally
Because max array u can make inside function is close to 10^6

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.