http://www.geeksforgeeks.org/find-a-sorted-subsequence-of-size-3-in-linear-time/