I am struggling to get the optimal subtructure to solve the problem i.e. the recurrence that has to be followed and upon which Dynamic Programming Solution can be build for optimizing the Time Complexity.
Suppose A and B have 2 kinds of Stones. There are A stones of the first type and B of the second type. They decide to play a game according to rules such in each turn one of the following valid moves can be done:
- Pick some Stones of first type
- Pick some Stones of Second type
- Pick equal number of Stone of both type
They have to pick atleast one Stone in each turn. Whoever makes the last move wins the game. Both play optimally. However while telling the rules of the competition, Alice cheated a bit to ensure that she wins the game by deciding who will take the first move.
Given the Stones, determine if Alice takes the first move or not.