package leetcode;

/**
 * https://leetcode.com/problems/predict-the-winner/
 */
public class Problem486 {
    public boolean PredictTheWinner(int[] nums) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem486 prob = new Problem486();
        System.out.println(prob.PredictTheWinner(new int[]{1, 5, 2})); // false
        System.out.println(prob.PredictTheWinner(new int[]{1, 5, 233, 7})); // true
    }
}

@@ -161,37 +161,984 @@
     
-// TODO%0A        return false;
+PlayerSum ps = predict(nums, 0, nums.length - 1, Player.P2);%0A        System.out.println(ps.player + %22 %22 + ps.sum);%0A        return false;%0A    %7D%0A%0A    private static class PlayerSum %7B%0A        private final Player player;%0A        private final int sum;%0A%0A        public PlayerSum(Player player, int sum) %7B%0A            this.player = player;%0A            this.sum = sum;%0A        %7D%0A    %7D%0A%0A    private static PlayerSum predict(int%5B%5D nums, int start, int end, Player p) %7B%0A        if (start == end) %7B%0A            return new PlayerSum(p, 0);%0A        %7D%0A        Player nextPlayer = (p == Player.P1) ? Player.P2 : Player.P1;%0A        PlayerSum ps1 = predict(nums, start + 1, end, nextPlayer);%0A        PlayerSum ps2 = predict(nums, start, end - 1, nextPlayer);%0A%0A        int a = nums%5Bstart%5D + Math.min(ps1.sum, ps2.sum);%0A        int b = nums%5Bend%5D + Math.min(ps1.sum, ps2.sum);%0A        int max = Math.max(a, b);%0A        // TODO%0A        return null;%0A    %7D%0A%0A    private enum Player %7B%0A        P1, P2
 %0A   
@@ -1310,16 +1310,18 @@
 / false%0A
+//
         

Update problem 486