1. The problem
You are in an interview. The interviewer reads out a problem you have never seen, the clock is running, and nobody says "this is a sliding window" or "use a heap". On-call it is the same: an alert fires, and the situation is new. First you have to work out what kind of problem it is, and only then touch the code.
Every step of the course before this one gave you the label. You knew step 51 was about stacks because its title said so. Real work has no label. The whole course built one skill for this moment: look at a problem with no label, decide which pattern fits, and say why, out loud, while someone watches.
This is the final test (a capstone). There is no new algorithm here. What it tests is how you recognize patterns and reason under pressure, across everything in steps 00 to 148.
This step is part of the paid track
The first 33 steps are open to everyone: lesson, exercise and tests. This one opens with full access. Start with a free account and the free steps.
Create a free accountSee what is includedOn LeetCode
Any problem with its topic tags hidden. Turn the tags off on LeetCode, read the limits first, say a brute force and its cost out loud, and only then pick a pattern. The problems below come from different lessons, and each reason names only the first clue.
n is up to 10^5 and the answer must be O(n), so ask which lookup lets you skip the sort.
The answer is a speed you can test with one pass, and a faster speed never hurts.
The rot spreads from many cells at once, one step per minute.
You want the longest stretch that obeys a rule about what is inside it.
The water over a bar depends on the tallest bar to its left and the tallest to its right.