#K38822. Detecting the 132 Pattern

    ID: 26284 Type: Default 1000ms 256MiB

Detecting the 132 Pattern

Detecting the 132 Pattern

You are given an array of unique integers. Your task is to determine whether there exists a 132 pattern in the array. A 132 pattern is a subsequence of three integers nums[i], nums[j], nums[k] such that:

$i < j < k$ and $\text{nums}[i] < \text{nums}[k] < \text{nums}[j]$

If such a pattern exists, print True. Otherwise, print False.

Example: For the array [3, 1, 4, 2], one valid pattern is (3, 4, 2) since $3 < 2 < 4$, so the answer is True.

inputFormat

The input is given via standard input (stdin). The first line contains an integer n, denoting the number of elements in the array. The second line contains n space-separated integers representing the array.

outputFormat

Output a single line to standard output (stdout) containing True if the array contains a 132 pattern as defined above; otherwise, output False.

## sample
4
1 2 3 4
False

</p>