Your question is Add Unique Numbers in Sequence. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
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):