Code Room
CodingEasycod-g1268
Subject HashingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A word game scores each letter with a point table: a dictionary mapping single-character strings to integer point values. The score of a word is the sum of the point values of its characters, counted once per occurrence; characters missing from the table are worth 0 points. Given the word and the table, return its total score. For example, "cab" with {"a": 1, "b": 3, "c": 3} scores 3 + 1 + 3 = 7, and "dog" with {"d": 2, "g": 3} scores 5 because "o" is unpriced.

Implement
word_score(word: str, points: dict[str,int]) → int
Examples
in["cab",{"a":1,"b":3,"c":3}]out7
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.