JSON subset parser
Write a recursive-descent parser for a tiny JSON subset and return the parsed Python value. Grammar: a value is an integer (optional leading minus, no decimals), a double-quoted string with no escapes, the literals true/false/null, or an array '[' value (',' value)* ']' (arrays may be empty). There is no whitespace anywhere in the input. Map true/false to Python booleans and null to the string "null". The input is guaranteed well-formed.
Implement
parse_json_subset(s: str) → objectExamples
in
["[1,\"hi\",true]"]out[1,"hi",true]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.
0:00 of about 40 min
solution.py
InputExpectedGot
["[1,\"hi\",true]"][1,"hi",true]not run yetsample