132 Pattern
medium
Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Return true if there is a 132 pattern in nums, otherwise, return false.
Constraints
1. n == nums.length 2. 1 <= n <= 10^4 3. -10^9 <= nums[i] <= 10^9
Format
Input
A number n. n1 n2 .... n numbers
Output
print true if 132 pattern is found otherwise false.
Example
Sample Input
4
3
1
4
2
Sample Output
true
Question Video