PredictWinner { public boolean PredictTheWinner(int[] nums) { int[][] dp = new int[nums.length][nums.length]; for (int i = 0; i < nums.length; i++) { dp[i][i] = nums[i]; } for (int i = 1; i < nums.length; i++) { for (int j = i - 1; j >=0; j--) { dp[j][i] = Math.max(nums[i] - dp[j][i - 1], nums[j] - dp[j + 1][i]); } } return dp[0][nums.length - 1] >= 0; }  boolean PredictTheWinner(int[] nums);  }
@Test(dataProvider = "competitionNums") public void test(int[] nums, boolean expectedResult) { assertEquals(new PredictWinner().PredictTheWinner(nums), expectedResult); }