package leetcode;

/**
 * https://leetcode.com/problems/split-array-into-consecutive-subsequences/
 */
public class Problem659 {
    public boolean isPossible(int[] nums) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem659 prob = new Problem659();
        System.out.println(prob.isPossible(new int[]{1, 2, 3, 3, 4, 5})); // true
        System.out.println(prob.isPossible(new int[]{1, 2, 3, 3, 4, 4, 5, 5})); // true
        System.out.println(prob.isPossible(new int[]{1, 2, 3, 4, 4, 5})); // false
        System.out.println(prob.isPossible(new int[]{1, 2, 3, 3, 4, 4, 5, 6})); // true
    }
}

@@ -12,16 +12,100 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.PriorityQueue;%0A%0A
 /**%0A * h
@@ -262,35 +262,789 @@
     
-// TODO%0A        return fals
+List%3CPriorityQueue%3CInteger%3E%3E listQueue = new ArrayList%3C%3E();%0A        for (int i = 0; i %3C nums.length; i++) %7B%0A            boolean newQueue = true;%0A            for (PriorityQueue%3CInteger%3E queue : listQueue) %7B%0A                if (queue.peek() %3C nums%5Bi%5D) %7B%0A                    newQueue = false;%0A                    queue.add(nums%5Bi%5D);%0A                    break;%0A                %7D%0A            %7D%0A            if (newQueue) %7B%0A                PriorityQueue%3CInteger%3E queue = new PriorityQueue%3C%3E((a, b) -%3E Integer.compare(b, a));%0A                queue.add(nums%5Bi%5D);%0A                listQueue.add(queue);%0A            %7D%0A        %7D%0A        for (PriorityQueue%3CInteger%3E queue : listQueue) %7B%0A            if (queue.size() %3C 3) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return tru
 e;%0A 
@@ -1212,32 +1212,34 @@
 , 5%7D)); // true%0A
+//
         System.o
@@ -1306,24 +1306,26 @@
 )); // true%0A
+//
         Syst
@@ -1395,16 +1395,18 @@
 / false%0A
+//
         

Update problem 659