Your question is Coding: 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.
An Alten engineering workflow receives numeric measurements and a target relationship to validate. Given an integer array nums and an integer target, return the indices of the two distinct elements whose values add up to target.
You may assume that every valid input contains exactly one solution. Return the indices in ascending order, and do not use the same array element twice.
nums, a list of integers, and target, an integer.[i, j], where i < j and nums[i] + nums[j] == target.two_sum(nums, target).Use a hash map to store values encountered during a single left-to-right scan. For each value, check whether its complement, target - value, has already been seen.
def two_sum(nums, target):