package leetcode;

/**
 * https://leetcode.com/problems/increasing-triplet-subsequence/
 */
public class Problem334 {
    public boolean increasingTriplet(int[] nums) {
        // TODO
        return false;
    }

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

@@ -174,15 +174,898 @@
     
-// TODO
+int n = 3;%0A        if (nums.length %3C n) %7B%0A            return false;%0A        %7D%0A        int count = 0;%0A        int prev = nums%5B0%5D;%0A        int lower = Integer.MIN_VALUE;%0A        for (int i = 1; i %3C nums.length; i++) %7B%0A//            System.out.println(%22i=%22 + i + %22, val=%22 + nums%5Bi%5D);%0A//            System.out.println(%22 - %22 + prev + %22 %3C %22 + nums%5Bi%5D);%0A            if (prev %3C nums%5Bi%5D) %7B%0A                lower = prev;%0A                count++;%0A//                System.out.println(%22 - increment counter: %22 + count);%0A//                System.out.println(%22 - prev: %22 + prev);%0A            %7D else if (prev %3E nums%5Bi%5D) %7B%0A                if (lower %3E= nums%5Bi%5D) %7B%0A                    count--;%0A                %7D%0A            %7D%0A//            System.out.println(%22 - setting prev to: %22 + nums%5Bi%5D);%0A            prev = nums%5Bi%5D;%0A            if (count == n - 1) %7B%0A                return true;%0A            %7D%0A        %7D
 %0A   
@@ -1179,16 +1179,18 @@
 m334();%0A
+//
         
@@ -1267,16 +1267,18 @@
 // true%0A
+//
         
@@ -1356,16 +1356,703 @@
 / false%0A
+//        System.out.println(prob.increasingTriplet(new int%5B%5D%7B1, 9, 8, 7, 6, 15, 3, 2, 4%7D)); // true%0A//        System.out.println(prob.increasingTriplet(new int%5B%5D%7B10, 9, 8, 7, 6, 15, 1, 3, 2, 4%7D)); // true%0A//        System.out.println(prob.increasingTriplet(new int%5B%5D%7B5, 1, 5, 5, 2, 5, 4%7D)); // true%0A//        System.out.println(prob.increasingTriplet(new int%5B%5D%7B0, 4, 2, 1, 0, -1, -3%7D)); // false%0A//        System.out.println(prob.increasingTriplet(new int%5B%5D%7B2, 1, 5, 0, 3%7D)); // false%0A//        System.out.println(prob.increasingTriplet(new int%5B%5D%7B1, 2, 1, 2, 1, 2, 1, 2, 1, 2%7D)); // false;%0A        System.out.println(prob.increasingTriplet(new int%5B%5D%7B1, 0, 0, 0, 10, 0, 1000%7D)); // true%0A
     %7D%0A%7D%0A

Update problem 334