package leetcode;

/**
 * https://leetcode.com/problems/reveal-cards-in-increasing-order/
 */
public class Problem950 {
    public int[] deckRevealedIncreasing(int[] deck) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem950 prob = new Problem950();
        System.out.println(prob.deckRevealedIncreasing(new int[]{17, 13, 11, 2, 3, 5, 7})); // [2,13,3,11,5,17,7]
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -205,35 +205,455 @@
     
-// TODO%0A        return null
+Arrays.sort(deck);%0A        int%5B%5D answer = new int%5Bdeck.length%5D;%0A        System.out.println(%22sorted: %22 + Arrays.toString(deck));%0A        int n = deck.length / 2;%0A        if (deck.length %25 2 != 0) %7B%0A            n++;%0A        %7D%0A        for (int i = 0, j = 0; i %3C n; i++, j += 2) %7B%0A            answer%5Bj%5D = deck%5Bi%5D;%0A        %7D%0A        for (int i = n, j = 1; i %3C deck.length; i++, j += 2) %7B%0A            answer%5Bj%5D = deck%5Bi%5D;%0A        %7D%0A        return answer
 ;%0A  
@@ -773,16 +773,45 @@
 println(
+Arrays.toString(%0A            
 prob.dec
@@ -865,16 +865,17 @@
  5, 7%7D))
+)
 ; // %5B2,
@@ -890,16 +890,1094 @@
 5,17,7%5D%0A
+        System.out.println(Arrays.toString(%0A            prob.deckRevealedIncreasing(new int%5B%5D%7B17, 13, 11, 2, 3, 5, 7, 20%7D))); // %5B2,11,3,17,5,13,7,20%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3%7D))); // %5B1,3,2%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3%7D))); // %5B1,2%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3, 4%7D))); // %5B1,3,2,4%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3, 4, 5%7D))); // %5B1,5,2,4,3%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3, 4, 5, 6%7D))); // %5B1,4,2,6,3,5%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3, 4, 5, 6, 7%7D))); // %5B1,6,2,5,3,7,4%5D%0A//        System.out.println(Arrays.toString(%0A//            prob.deckRevealedIncreasing(new int%5B%5D%7B1, 2, 3, 4, 5, 6, 7, 8%7D))); // %5B1,5,2,7,3,6,4,8%5D%0A
     %7D%0A%7D%0A

Update problem 950