Brackets All over problem

Can an ane please explain me the algorithm to solve the problem

@Faizan-Ali-1395131367301898,
If Piyush wants to attain a maximum score, then:

Case 1: Piyush’s Turn

He will try to choose the coin which would benefit him the most i.e a coin that would make his final score greatest possible.

Case 2 : Piyush’s opponent’s turn

As the opponent in competing with Piyush, he will try to pick a coin that would benefit him (the opponent) the most and thus obviously benefit Piyush the least, in other words, this move in Piyush’s perspective would be a move where he would get a coin which would benefit him the least.

Conclusion:

The whole game breaks down to 2 simple moves, in odd numbered moves recursively ask for a coin which gives maximum profit to Piyush, and in even numbered moves recursively ask for coin which gives minimum profit to Piyush.

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.

I am asking about brackets all over problem

hey first try use recursion ,use set and take character ‘(’ and ‘)’ and concatenate with current string at different positions and call recursion.Here is code for reference.

can u please explain (temp+1)*x in ur code risabh

@Faizan-Ali-1395131367301898 hey,you have to tell combinations so for that (temp+1) *x is taken,temp me difference hai elements ka x me size to dono ka multiplication hme no of combinations dega.

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.