Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number will not be available for the…
public class Solution { public bool PredictTheWinner(int[] nums) { // int n = nums.Length; // int[,] dp = new int[n, n]; // for (int i = 0; i < n; i++) { dp[i, i] = nums[i]; } // for (int len = 1; len < n; len++) // { // for (int i = 0; i < n - l…