Akshat and Akanksha were given some toffees and a bar of chocolate. T...
In these types of games, one has to rely on backward induction. This means that we start from the end of the game and work towards the start.
Let (a,b) denote that there are 'a' and 'b' toffees in the two columns.
Since there is no constraint on how many toffees a person can pick up from a single column, the number of toffees left in a single column does not matter if the other column is empty. Hence to win, a player should never pick up all the toffees from a column. Since the players are playing logically and to win, they will never do this.
Hence on the second last turn, at least 1 toffee is left in each column.
If (1,1) toffees are left in each column, then the person whose turn it is next can pick up only one toffee and has to pick one up as per the rules. This leaves 1 toffee on the table, and the other person wins.
Hence if (1,1) toffees are left, the person whose turn it is next will lose.
But if a person wants to win, and leaves 1 toffee in one column and 2 or more toffees in the other, then the other player will just pick up one toffee from the column which has 2 toffees.
But if Player X leaves 2 toffees in each column after his/her turn, then no matter how many toffees are picked up next, he/she will always win:
Case 1: If Player Y person picks 1, the X has to pick 1 from the other column, leaving (1, 1) toffees, which is a winning situation for the X
Y cannot pickup 2, as explained earlier that a logical player will not empty a column, as it means immediate defeat.
Hence if (2, 2) toffees are left, the person whose turn it is next will lose.
Hence we can see the pattern that a person has to leave an equal number of toffees in each column after their turn to ensure winning. Hence a person must pickup the number of toffees which makes the toffees equal in both the columns.
Initially, the number of toffees were (7, 5). So Akshat will pick up 2 toffees to make it (5, 5).