Ctrl K

Does Any Value Repeat

Easy
A sensor has logged a series of readings, given as an integer array readings. Find out whether any reading occurred more than once. Return True if at least one value appears in the array two or more times, and False if all values are distinct.
Example 1
readings=[7, 42, -3, 18, 42] → True

The value 42 shows up twice, at positions 1 and 4.

Example 2
readings=[5, -5, 0, 50] → False

All four values differ, even though 5 and -5 have the same absolute value.

Example 3
readings=[9] → False

A single value has nothing to repeat with.

Constraints
  • 1 ≤ readings.length ≤ 10⁵
  • -10⁹ ≤ readings[i] ≤ 10⁹
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsThe Candidate With Most Votes EasyThe Lost Ticket EasyValues in Both Lists EasyShared Values With Repeats EasyValues One Apart Easy
loading Python…
Input
readings=[7, 42, -3, 18, 42]
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 94 tests on the server, hidden ones included.