Missing Number
Imagine one number was accidentally lost from the full sequence 1 to n. You are given a shuffled list nums of length n - 1 containing the remaining numbers. Return the missing number.
Примеры
Ввод
[1, 2, 4, 5], 5Вывод
3Ввод
[2, 3], 3Вывод
1Ввод
[1, 2], 3Вывод
3Нужно реализовать
def find_deleted(nums: list[int], n: int) -> int:
Теги
arraymath
Conectează-te pentru a vedea istoricul soluțiilor trimise
Conectează-teConectează-te pentru a folosi Mentorul AI
Conectează-teVisible tests
1
Input
[1,2,4,5], 5Expected
32
Input
[2,3], 3Expected
13
Input
[1,2], 3Expected
34
Input
[], 1Expected
15
Input
[3,7,1,2,8,4,5,6,9], 10Expected
106
Input
[1,2,4,5], 1Expected
-11Focus radio
Paused · SomaFM · Fluid