Trains the technique from
LeetCode 3731Find Missing ElementsThis 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 survey crew walks a trail and notes the number stamped on every marker post it comes across. found[i] is the number on the i-th post noted down. The crew doubles back a few times, so the notes are in no particular order and a post can appear in them more than once.
Take the smallest number in found and the largest number in found. Return, in increasing order, every whole number that lies strictly between those two and does not appear anywhere in found. Return an empty list when there is no such number.
Example 1
The notes run from 12 up to 20, and of the numbers in between only 15 and 17 were noted, so the rest are reported.
Example 2
The span from 61 to 63 has just 62 inside it, and 62 was noted, so nothing is missing.
Example 3
The smallest and largest notes are the same number, so the span between them holds nothing at all.
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 absent_posts(found: list[int]) -> list[int]:public List<Integer> absentPosts(int[] found)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.