What is the approach to this problem?

I know that this problem can be solved using recursion, but how to decide whose turn it is(in the question)?

Hey,for that you make two moves at a time so that each time Piyush takes turn.So, for each turn you either select two from start(1 for Piyush and other for Nimit) or two from end(again 1 for Piyush and other for Nimit) or 1 from start and 1 from end ( anyone of them takes from start, other takes from end).

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.