Remove duplicates

Remove repeated numbers from a list. Imagine a list of shirt numbers recorded whenever a player scores. Keep each player’s number only the first time it appears.

Read from left to right. Remember each new number and add it to the output row. Skip any number you have seen before.

For example, 4, 2, 4, 7 becomes 4, 2, 7.

Each number gets one turn. Using a hash set to check for repeats takes O(n) time on average for the whole row.