Increasing Triplet Subsequence

Given an integer array nums, determine if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. Return true if such indices exist, otherwise return false.

Constraints

  • 1 <= nums.length <= 5 * 10^5
  • -2^31 <= nums[i] <= 2^31 - 1
Saving… · 2 lines
class Solution:
def increasing_triplet(self, nums: List[int]) -> bool:
Console

Click Run to execute sample tests.