Question
Evaluate a WHERE-clause predicate tree against rows. A predicate node is either a comparison ['cmp', col, op, value] with op in '=','!=','>','<','>=','<=', or a boolean ['and', child1, child2, ...] / ['or', child1, child2, ...] / ['not', child]. Given rows (list of dicts) and one predicate, return the list of rows (in input order) for which the predicate evaluates to true. Comparisons use Python's natural ordering on the stored values. 'and' of zero children is true; 'or' of zero children is false.
filter_rows(rows: list[dict], pred: list) → list[dict][[{"a":1,"b":10},{"a":2,"b":5},{"a":3,"b":20}],["and",["cmp","a",">",1],["cmp","b",">=",10]]]out[{"a":3,"b":20}]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.