so i was doing some algorithm solving problems and the first questions input/output test case i am not able to understand. I am not asking here any algorithm or code, i just want to understand how Bob is winning ?
Alice and Bob play the following game:
1) They choose a permutation of the first N numbers to begin with.
2) They play alternately and Alice plays first.
3) In a turn, they can remove any one remaining number from the
permutation.4) The game ends when the remaining numbers form an increasing
sequence. The person who played the last turn (after which the
sequence becomes increasing) wins the game.Assuming both play optimally, who wins the game?
Test case
5 3 2 1 4
Now they say Bob will win the game.
How ?
alice -> remove 5
bob -> remove 3
alice -> remove 1/2 -> Wins
OR
alice -> remove 3
bob -> remove 5
alice -> remove 1/2 -> Wins
1 Answer