Increasing Triplet Subsequence

Medium · Arrays & Strings · about 15 minutes

Asked at Meta, Microsoft, Bloomberg, Amazon, Google.

Decide whether nums has three entries that rise strictly from left to right, i.e. positions i < j < k with nums[i] < nums[j] < nums[k]. Target O(n) time and O(1) extra memory.