FunctionRacerProblemsRace

Rising Triple

MediumArraysPython, JavaScript, TypeScript, Java, C++

Return True if nums contains three positions i < j < k with nums[i] < nums[j] < nums[k]: three strictly rising values that appear in this order, not necessarily next to each other. Otherwise return False.

Equal values never count as rising, so [1, 1, 2] gives False.

Example 1

nums [2,1,5,0,4,6]
returns true

Positions 1, 4 and 5 hold 1, 4 and 6.

Example 2

nums [5,4,3,2]
returns false

The values only go down.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Arrays problems