Tell me about a time you modified the Two Sum problem and analyzed the time and space complexity of your solution.
Describe a concrete variation of Two Sum, then explain the algorithm you would use and its complexity. Keep the answer focused on the modified requirement, the data structure choice, and the resulting trade-offs.
def modified_two_sum(nums, target):