Two players take turns picking a number from either end of the array nums, adding it to their score. Assuming both play optimally, return true if the first player can end with a score at least as high as the second player. The input is JSON {nums}.
Input: JSON {nums}.
Output: Boolean — true if the first player can win or tie.
Input: {"nums":[1,5,2]}
Output: false
Explanation: Player 2 can force at least a tie.Input: {"nums":[1,5,233,7]}
Output: true
Explanation: Player 1 wins.Input: {"nums":[1]}
Output: true
Explanation: Player 1 takes everything.1<=n<=20