Trains the technique from
LeetCode 1109Corporate Flight BookingsThis 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 press decorates a strip of n tiles laid out in a line and numbered 1 through n.
The head makes one pass for each entry of passes. The entry passes[i] = [first, last, drops] means that pass left drops drops of ink on tile first, on tile last, and on every tile lying between the two. A tile visited by several passes keeps the ink from all of them.
Return an array total of length n, where total[j] is the number of drops sitting on tile j + 1 once every pass has run.
Example 1
Tile 1 is reached by the first pass alone, so it holds 20 drops. Tile 2 is reached by the first two passes, giving 27. Tile 4 is reached by the second and third passes, giving 37.
Example 2
The second pass covers tile 6 only. Tile 6 is the last tile of all three passes, so it collects 4 + 11 + 1 drops, while tile 1 is covered by the third pass alone.
Example 3
No pass reaches tile 3 or tile 4, so those tiles stay bare, and the four tiles that are covered each get 6 drops.
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 ink_per_tile(passes: list[list[int]], n: int) -> list[int]:public int[] inkPerTile(int[][] passes, int n)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.