Given an integer array nums, determine whether there exist indices i, j, and k such that i < j < k and nums[i] < nums[j] < nums[k].
Return true if such a triplet exists; otherwise, return false.
Note: Could you implement a solution that runs in
O(n)time complexity andO(1)space complexity?
Constraints:
nums.length
nums[i]
Given an integer array nums, determine whether there exist indices i, j, and k such that i < j < k and nums[i] < nums[j] < nums[k].
Return true if such a triplet exists; otherwise, return false.
Note: Could you implement a solution that runs in
O(n)time complexity andO(1)space complexity?
Constraints:
nums.length
nums[i]