Can't decide on the approach

How will we get previous row values? should I use array to store previous row?

@simar94.singh Yes you can use a two dimensional array for that purpose .

https://ide.codingblocks.com/s/180366 what am i missing?

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.