FunctionRacerProblemsRace

Already Seen Flags

BeginnerHash mapsPython, JavaScript, TypeScript, Java, C++

For every position i of nums, decide whether the value nums[i] already appeared at an earlier position of the list.

Return a list of booleans with the same length as nums: True where the value was seen before, False where the value appears for the first time. The empty list gives [].

Example 1

nums [1,2,1,3,2]
returns [false,false,true,false,true]

The second 1 and the second 2 are repeats; everything else is new.

Example 2

nums [5,5,5]
returns [false,true,true]

The first 5 is new, the next two are repeats.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems