Trains the technique from
LeetCode 1353Maximum Number of Events That Can Be AttendedThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A safety office has one inspector and a list of sites waiting to be inspected. Entry windows[i] = [opens, closes] means site i may be inspected on any single whole day from day opens to day closes inclusive.
The inspector carries out at most one inspection per day and needs the whole day for it. A site is either inspected on one day inside its window or not inspected at all, and days may be left empty.
Return the largest number of sites the inspector can get through.
Example 1
The second site is inspected on day 1, its only day, and the first site on day 2, which is inside its window of days 1 to 2.
Example 2
All three windows span days 1 to 3, so the inspector takes one site on each of those days.
Example 3
Day 1 takes one of the two sites whose window is that single day, and day 2 takes the third site. The remaining site has no day left inside its window.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def most_inspections(windows: list[list[int]]) -> int:public int mostInspections(int[][] windows)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.