Question
Write a validator that decides whether a string is a well-formed decimal number under this grammar: an optional leading '+' or '-' sign, then a mantissa, then an optional exponent. The mantissa is either digits, or digits '.' digits, or digits '.', or '.' digits (at least one digit total). The exponent is 'e' or 'E', an optional sign, then one or more digits. No spaces are allowed. Return True if the entire string matches, else False. Examples that are valid: '0', '-3.14', '.5', '2.', '1e10', '+6E-9'. Invalid: '', '.', '1e', 'e3', '1.2.3', '+-1', '1e1.5'.
is_number(s: str) → bool["-3.14"]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.