Given an array of integers, write a function to find the two numbers that sum up to a specific target. Follow up: optimize it for time complexity. Implement two_sum(nums, target), returning the two distinct zero-based indices as a list. Assume every valid input contains exactly one solution, and return an empty list only if no pair exists.
def two_sum(nums, target):