Greedy
153 / 170GreedyLesson 7 of 9About 41 min
Look ahead once, then walk forward and let the lookahead tell you when you may stop.
This splits a permutation of 0 through n-1 into the largest chunks that can each be sorted on their own. Every size after the first comes out too large. Click the line that is wrong.
Read the constraints first and let them tell you what complexity is expected. Derive the approach, implement it, run the tests, and submit when it passes.