Given an integer array nums and an integer target, return the indices of the two distinct elements whose sum equals target. Return the answer as a list of two indices in any order. You may assume exactly one valid pair exists, and the same element cannot be used twice.
def two_sum(nums, target):