Predict the Winner
Medium · Dynamic Programming · about 20 minutes
Asked at Google, Amazon, Microsoft, Meta.
Two players take turns picking a number from either end of the array nums, adding it to their score. Player 1 goes first and both play optimally. Return true if Player 1 can win (a tie counts as a win for Player 1).