Missing After Shuffle
You have a complete list full and another list part made by removing exactly one element from it and shuffling the rest. Write a function find_deleted that finds which number disappeared. The solution should run in O(N). The order of elements in the second list does not matter.
Примеры
Ввод
[1, 2, 3, 4, 5], [1, 2, 4, 5]Вывод
3Ввод
[10, 20, 30], [10, 30]Вывод
20Ввод
[5], []Вывод
5Нужно реализовать
def find_deleted(full: list[int], part: list[int]) -> int:
Теги
arraymath
Přihlaste se, abyste viděli historii odevzdání
Přihlásit sePřihlaste se, abyste mohli použít AI mentora
Přihlásit seVisible tests
1
Input
[1,2,3,4,5], [1,2,4,5]Expected
32
Input
[10,20,30], [10,30]Expected
203
Input
[5], []Expected
54
Input
[1,1,2], [1,2]Expected
15
Input
[7,8,9,10], [10,8,7]Expected
96
Input
[2,3,4,5,6], [1,2]Expected
17Focus radio
Paused · SomaFM · Fluid