Total Spend per Customer

Advanced

A billing run has two parallel lists: customer keys and the amount charged on each line. Roll these up into total spend per customer.

Implement `solve(List<String> keys, List<Integer> amounts)` (same length, index-aligned) to return a Map<String, Integer> summing amounts per key.

Examples

Inputkeys=[x,y,x], amounts=[10,5,20]
Output{x=30, y=5}
Hints
  • Index both lists together; accumulate amounts[i] into totals for keys[i].
Anonymous Apex

Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.