Code Room
CodingEasycod-g1213
Subject Data wranglingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A shop's daily sales feed stores one line item per row as "category,amount", where amount is an integer that may be negative (a refund). Build the mini pivot the manager sees each evening: a dictionary mapping each category to the sum of its amounts. Example: ["toys,20", "games,15", "toys,5"] gives {"toys": 25, "games": 15}.

Implement
category_totals(rows: list[str]) → dict[str,int]
Examples
in[["toys,20","games,15","toys,5"]]out{"toys":25,"games":15}
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.