Explain your approach to solving Two Sum. Asked in the technical phone screen stage.
Implement a function that returns the indices of two distinct numbers in nums whose sum equals target. Assume exactly one valid answer exists and the same element cannot be used twice.
Function signature: def two_sum(nums, target):
Input: nums is a list of integers, target is an integer.
Output: return a list of two indices in any order.
def two_sum(nums, target):