Trains the technique from
LeetCode 217Contains DuplicateThis 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 stamps every benchmark it visits with that benchmark's height above the datum, in whole centimetres. Benchmarks sunk below the datum get a negative stamp, and one right on it gets 0. The stamps come back as the array marks, in visiting order.
A stamp is supposed to identify a benchmark on its own, so the crew needs to know whether any height was stamped on more than one benchmark. Return true if some value occurs at two or more positions of marks, and false if every stamp is distinct.
Heights the same distance either side of the datum are different heights: -40 and 40 are two separate stamps, not a repeat.
Example 1
The stamp -3 was used at the second benchmark and again at the last one, so the crew has a collision.
Example 2
Four different heights, one of them exactly at the datum, and no value comes back twice.
Example 3
The two benchmarks sit the same distance from the datum but on opposite sides, so their stamps differ.
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 repeated_elevation(marks: list[int]) -> bool:public boolean repeatedElevation(int[] marks)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.