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.
Input Format
A number n. n1 n2 .... n numbers
Output Format
print true if 132 pattern is found otherwise false.
Constraints
1. n == nums.length 2. 1 <= n <= 10^4 3. -10^9 <= nums[i] <= 10^9
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 3 1 4 2
Output
true