Cargando el ejercicio…
In the list, almost every number appears exactly twice, and only one number has no pair. The function single_number receives a list nums and returns the only number that appears once. This is a good place to use bitwise XOR, because it lets you solve the problem without storing extra data structures.
[2, 2, 1]1[4, 1, 2, 1, 2]4[1]1def single_number(nums: list[int]) -> int:
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesión[2,2,1]1[4,1,2,1,2]4[1]1[7,3,7,3,9]9[]0[1,2,2]1