486 Predict the Winner
486. Predict the Winner
1. Question
Input:
[1, 5, 2]
Output:
False
Explanation:
Initially, player 1 can choose between 1 and 2.
If he chooses 2 (or 1), then player 2 can choose from 1 (or 2) and 5. If player 2 chooses 5, then player 1 will be left with 1 (or 2).
So, final score of player 1 is 1 + 2 = 3, and player 2 is 5.
Hence, player 1 will never be the winner and you need to return False.2. Implementation
3. Time & Space Complexity
Last updated