Greedy
150 / 170GreedyLesson 4 of 9About 46 min
Two separate facts, each cheap: whether an answer exists at all, and where it must be.
The running balance goes negative at stop k, having started the current attempt at stop s. Why can every stop from s to k be ruled out at once?
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.