Python: a modification of Two Sum
Asked in the R1 stage. Given a list of integers and a target, return every unique pair of values whose sum equals the target. Each input element may be used at most once, duplicate pairs must be removed, and the result must be ordered lexicographically by pair values.
Input: nums, a list of integers, and target, an integer.
Output: A list of two-element lists. Return [] when no pair exists.
Example: nums = [1, 2, 2, 3, 4, 5], target = 6 returns [[1, 5], [2, 4]]. The pair [2, 4] appears once despite duplicate 2 values.
def unique_two_sum_pairs(nums, target):