please can you help me how to apprpach this question
and how to implement this problem
Please can you help me how to approach this question
Hi Vivek
I remember this question as it had been asked in my Samsung interview. It is basically a variant of an old game in which we used to control a rocket on screen and we used to go forward to collect maximum coins while avoiding meteorites which would damage our rocket’s health.
To aisa hi hai is variant mei bhi, screen ki width 5 fix kar rakhi hai aur aapke paas ek super power hai jo aap ek time use kar sakte ho jisse aap saare meteorites ko blast kar skate ho(convert all -1 to 0 present on your screen).
Isko aap aise samjho, aapki screen hai game ki 5x5 ki, theek. Aap center ekdum lowest row se shuru karte ho aur aage badhte ho, matlab har samay par aapke screen pe ek 5x5 ki window present hogi, jisme blank(0), coins(+1) aur rocks (-1) honge. Aap ek baar apni superpower use kar sakte ho to destroy all rocks.
So you have to play with recursion in this. DFS/BFS are hints