Code Room
CodingEasy
Question
An audit script fingerprints ticket IDs by summing the digit characters they contain. Given a string that may mix letters, digits, and punctuation, return the sum of all digit characters as a number. Return 0 if there are no digits. For example, 'ord-42x9' contains 4, 2, and 9, so the answer is 15.
Implement
digit_sum(s: str) → intExamples
in
["ord-42x9"]out15What 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.
Learn the concepts
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.