FSS payment-processing workflows may receive repeated numeric amounts within a sequence. Given a sequence of integers, return the sum of each distinct value exactly once.
The order of values does not affect the result. Negative numbers and zero must be handled normally. Aim for a single pass through the sequence using additional memory proportional to the number of distinct values.
Implement sum_unique_amounts(amounts).
amounts, a list of integers.amounts.amounts is empty, return 0.def sum_unique_amounts(amounts):