Your question is Solve Two Sum. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Cisco telemetry services may need to identify two measurements whose combined value reaches a specified threshold. Given an unsorted array of integers nums and an integer target, return the indices of two distinct elements whose values add up to target.
Use each array position at most once. Return the pair as [i, j], where i < j. Each valid input contains exactly one solution, so the order of the returned indices is deterministic. Aim for a one-pass solution with better than quadratic time.
Implement two_sum(nums, target).
nums, a list of integers, and target, an integer.target.def two_sum(nums, target):