Key idea: use two variables to store the value with increasing subsequence of length 1 and length 2, respectively. Keep updating the two variables if we get to a smaller candidate ending up with the same length.

```
public boolean increasingTriplet(int[] nums) {
int length1EndHere = 0x7fffffff, length2EndHere = 0x7fffffff;
for(int i=0, N=nums.length; i<N; i++) {
if(nums[i] > length2EndHere) return true;
else if(nums[i] > length1EndHere) length2EndHere = Math.min(nums[i], length2EndHere);
else length1EndHere = nums[i];
}
return false;
}
```

If you are interested in my other posts, please feel free to check my Github page here: https://github.com/F-L-A-G/Algorithms-in-Java