Skip to content
BytePatterns

Repeated Value Check

EasyHash Tables#hash-set#single-pass~10m

Problem

Given a list of values, decide whether any value shows up more than once. Return true if at least one value repeats anywhere in the list, and false when every value is unique. The repeats do not have to be next to each other.

Examples

Input:  items = [4, 1, 9, 1]
Output: True
Why:    the value 1 appears at two different positions
Input:  items = [4, 1, 9]
Output: False
Why:    all three values differ
Input:  items = []
Output: False
Why:    edge case, an empty list cannot contain a repeat

Hints

0 / 3

Stuck on the idea rather than the code? Hash Table Basics covers it.