Problem
A 132 pattern in a list nums is three positions i < j < k with nums[i] < nums[k] < nums[j]: a small value, then a big one, then one in between (like the digits 1, 3, 2). Return true if nums contains a 132 pattern, otherwise false. The three values do not have to be next to each other.
Example 1
- Input
- nums = [1, 2, 3, 4]
- Output
- false
Example 2
- Input
- nums = [3, 1, 4, 2]
- Output
- true
- Why
- 1, 4, 2
Example 3
- Input
- nums = [-1, 3, 2, 0]
- Output
- true
- Why
- -1, 3, 2
Constraints
n == nums.length1 <= n <= 2 * 10^5-10^9 <= nums[i] <= 10^9