Given an integer array arr, determine if there exist indices x, y, z such that x < y < z and arr[x] < arr[y] < arr[z]. Return True if such a triplet exists, otherwise return False.
Example 1
Input: [7, 8, 9, 1, 2]
Output: True
Explanation: Triplet (0, 1, 2): 7 < 8 < 9.
Example 2
Input: [10, 9, 8, 7]
Output: False
Explanation: No increasing triplet exists.
Example 3
Input: [3, 1, 4, 2, 5]
Output: True
Explanation: Triplet (1, 2, 4): 1 < 4 < 5.
Constraints
Case 1
Input: [4, 5, 1, 2, 3]
Expected: True
Case 2
Input: [6, 5, 4, 3, 2, 1]
Expected: False
Case 3
Input: [1, 2, 1, 2, 1, 2, 3]
Expected: True
Case 4
Input: [2, 2, 2, 2, 2]
Expected: False
Case 5
Input: [1, 3, 2, 4]
Expected: True