Fácil15 pts
Two Sum
Traducción al español en progresoEl contenido detallado de esta lección aún se está traduciendo. Mientras tanto, se muestra en inglés.
Given an array of integers and a target sum, find two numbers that add up to the target. Return the indices (0-based) of the two numbers. Assume exactly one solution exists and you may not use the same element twice. Example: nums=[2,7,11,15], target=9 → nums[0]+nums[1]=2+7=9 → Output: '0 1'
Entrada
Line 1: n (array size). Line 2: n space-separated integers. Line 3: target.
Salida
Two space-separated indices (0-based, smaller first).
Ejemplo
4 2 7 11 15 9
Esperado
0 1
Loading editor…
Resultado
Sin salida aún. Ejecuta tu código para ver resultados.