Code:
from typing import List
from random import randint


def has_duplicates(l: List[int]) -> bool:
    ...


print(has_duplicates([]))                     # False
print(has_duplicates([9, 3, 2, 5, 1]))        # False
print(has_duplicates([1, 1]))                 # True
print(has_duplicates([1, 2, 2, 3, 1, 5, 1]))  # True


def find_duplicates(l: List[int]) -> List[int]:
    ...

print(find_duplicates([]))                     # []
print(find_duplicates([1, 2, 3, 5, 9]))        # []
print(find_duplicates([1, 1]))                 # [1]
print(find_duplicates([1, 2, 2, 3, 1, 5, 1]))  # [1, 2] ou [2, 1]
Modifié le: vendredi, 1 novembre 2019, 10:18