456. 132 模式
class Solution {
public boolean find132pattern(int[] nums) {
if (nums.length < 3)
return false;
Deque<Integer> stack = new LinkedList<>();
int k = Integer.MIN_VALUE;
for (int i = nums.length - 1; i >= 0; i--) {
if (nums[i] < k)
return true;
while (!stack.isEmpty() && stack.peek() < nums[i]) {
k = Math.max(k, stack.pop());
}
stack.push(nums[i]);
}
return false;
}
}