data-structures
Write a function solution(nums, target) that returns the indices of the two numbers that add up to target. Return them as a sorted list [i, j] where i < j.
Assume there is exactly one solution.
Example
solution([2, 7, 11, 15], 9) → [0, 1]
solution([3, 2, 4], 6) → [1, 2]
solution.py
💡 Tip: Press Ctrl+Enter to run