#K33937. Increasing Triplet Subsequence

    ID: 25198 Type: Default 1000ms 256MiB

Increasing Triplet Subsequence

Increasing Triplet Subsequence

Given an array of integers of length n, determine whether there exists an increasing triplet subsequence. In other words, check if there exist indices \(i, j, k\) such that \(i < j < k\) and \(nums[i] < nums[j] < nums[k]\). This problem tests your ability to find a strictly increasing sequence of three numbers within an array.

Constraints: \(1 \le n \le 10^5\). The array elements can be any integer within the range representable by your programming language.

inputFormat

The input is read from standard input (stdin). The first line contains an integer n indicating the number of elements in the array. The second line contains n space-separated integers representing the array elements.

outputFormat

Print to standard output (stdout) a single string: true if there exists an increasing triplet subsequence, or false if there is none.

## sample
5
1 2 3 4 5
true