Duplicate Check

Given a list of integers nums, check whether any number appears more than once. This is useful when you need to quickly spot duplicate data, such as repeated IDs or duplicate requests. Return True if there is at least one duplicate, otherwise return False.

Примеры

Ввод
[1, 2, 3, 1]
Вывод
True
Ввод
[1, 2, 3, 4]
Вывод
False
Ввод
[]
Вывод
False

Нужно реализовать

def contains_duplicate(nums: list[int]) -> bool:

Теги

arrayhashmap
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

Visible tests
1
Input
[1,2,3,1]
ExpectedTrue
2
Input
[1,2,3,4]
ExpectedFalse
3
Input
[]
ExpectedFalse
4
Input
[1,2,3,1,1,2]
ExpectedTrue
5
Input
[1,2,3]
ExpectedFalse
6
Input
[1,1,2,3]
ExpectedTrue
Focus radio
Paused · SomaFM · Fluid