Mark Seen Indices
Record which labels from 1 to n appear by sending label v to index v - 1.
The problem
Implement mark_seen_indices(values). Every value is an integer label from 1 to n, where n = len(values). Labels can repeat, so some labels may be missing. Return a list of n booleans where position i is True exactly when label i + 1 appears in values. For example, [4, 1, 4, 2] gives [True, True, False, True], and [1, 1] gives [True, False]. values may be empty.
Starter code
def mark_seen_indices(values):
passPublic examples
values = [4, 1, 4, 2]gives[True, True, False, True]values = [3, 1, 2]gives[True, True, True]
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
