Optimal strategy question

https://practice.geeksforgeeks.org/problems/geek-and-its-game-of-coins/0

plz correct my code and also explain the logic that u have used …

Here is your corrrected code https://ide.codingblocks.com/s/288124

The thing is any possition is winning if you only place you can go from there results in a certain loss, because then next player has to make a move.
Hence we mark a position true if we can go to atleast one losing position from that position.

https://practice.geeksforgeeks.org/problems/painting-the-fence/0

plz help to solve this problem as well…recursively first …

Plz reply at the earliest

plz reply at the earliest


This link has the approach, please see

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.