Describe a time you worked through a basic algorithm problem and an architecture question, and how you approached the tradeoffs.
For the coding portion, implement the algorithm below and be prepared to explain its correctness, complexity, and tradeoffs against a simpler approach. Given nums and target, return the indices of the first pair encountered whose values sum to target, or [] if no pair exists.
Function signature: two_sum(nums, target)
def two_sum(nums, target):