A Juniper Networks telemetry component receives an unsorted array of integer measurements and a target value. Return the indices of two distinct measurements whose values add up to the target.
Use an approach suitable for a single pass through the array. Each input is guaranteed to contain exactly one valid pair, and the same element cannot be used twice.
Implement two_sum(nums, target).
nums, a list of integers, and target, an integer.[i, j] where i < j and nums[i] + nums[j] == target.nums.def two_sum(nums, target):