Skip to content

#334 - Increasing Triplet Subsequence

MediumArray / String
Open on LeetCode

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]. Otherwise return false. Solve in O(n) time and O(1) space.

InputOutput
nums = [1,2,3,4,5]true
nums = [5,4,3,2,1]false
nums = [2,1,5,0,4,6]true

Released under the MIT License.