End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
keyMap) and another for prefix sums (prefixMap).insert method:
a. Calculate the value difference (delta) if the key already exists.
b. Update the value in keyMap.
c. Update the sums in prefixMap for each prefix of the key by adding delta.sum method:
a. Return the sum associated with the prefix in prefixMap, or 0 if the prefix does not exist.