Question
Write a lexer for a tiny expression language. Given a source string, return a list of `[type, lexeme]` tokens. Token types are: `NUM` (an integer or decimal like `12` or `2.5` or `.5`), `IDENT` (a name starting with a letter or underscore, then letters/digits/underscores), `OP` (one of `+ - * /`), `PAREN` (`(` or `)`), and `UNKNOWN` (any single other non-space character). Spaces separate tokens but are not emitted. Return tokens in source order.
tokenize(expr: str) → list[list]["3 + x"]out[["NUM","3"],["OP","+"],["IDENT","x"]]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.