Description
Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exist, return false.
Examples
Input:
nums = [1,2,3,4,5]Output:
trueExplanation:
Any triplet where i < j < k works.
Input:
nums = [5,4,3,2,1]Output:
falseExplanation:
No increasing triplet exists.
Input:
nums = [2,1,5,0,4,6]Output:
trueExplanation:
Triplet (1, 4, 5) at indices (1, 4, 5) or (0, 4, 5) works.
Constraints
- •
1 ≤ nums.length ≤ 5 × 10⁵ - •
-2³¹ ≤ nums[i] ≤ 2³¹ - 1