A Wealthfront Automated Investing feature receives an array of integer adjustments and a target total. Return the indices of the two distinct elements whose values add up to target.
Each input has exactly one valid pair, and the same array element cannot be used twice. Return the indices in ascending order. You may return an empty list only as a fallback for invalid inputs outside the stated constraints.
Implement two_sum(nums, target):
nums, a list of integers, and target, an integer.target.Design an algorithm that runs in linear time.
def two_sum(nums, target):