Question
Implement the Luhn checksum used to validate credit-card numbers. Given a card `number` as a string (which may contain spaces or dashes as separators), return True if it passes the Luhn check. The algorithm: from the rightmost digit moving left, double every second digit; if a doubled value exceeds 9 subtract 9; sum all resulting digits; the number is valid if the total is divisible by 10. Ignore non-digit separators. An input with no digits is invalid.
luhn_valid(number: str) → bool["4539148803436467"]outtrueState 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.