Detect the Repeated Entry
Intermediate SolvedA submission form should reject a batch if any value appears twice. Report whether a list contains any duplicate.
Implement `solve(List<Integer> nums)` to return true if the list contains any duplicate value, false otherwise.
Examples
Input
[1, 2, 3, 2, 5]Output
trueInput
[1, 2, 3]Output
falseHints
- If a Set built from the list is smaller than the list, there were duplicates.
Tests
Solved on this device only. Sign in with Google to keep your progress across devices.
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically. Keyboard users: press Esc then Tab to move focus out of the editor.