Trains the technique from
LeetCode 3217Delete Nodes From Linked List Present in ArrayThis 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 run of codes banned is given, no two of them the same, and a chain of tags follows.
Because the harness passes plain JSON, the chain reaches you as chain, listing the tag codes in order from the front.
Drop every tag whose code turns up in banned and return what is left, again as a plain list read from the front. At least one tag always survives.
Example 1
The three odd codes are banned, so the three even tags survive in the order they stood.
Example 2
Every tag coded 7 goes, whichever position it held, and the others keep their order.
Example 3
No tag carries the banned code, so the chain comes back untouched.
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 modified_list(banned: list[int], chain: list[int]) -> list[int]:public int[] modifiedList(int[] banned, int[] chain)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.