Given an integer array nums and an integer target, return the indices of the two distinct elements whose values add up to target. Return the answer as a list of two indices. You may assume exactly one valid pair exists, and you may not use the same element twice.
def two_sum(nums, target):