Question
Implement a tiny query engine. You are given rows (list of dicts with the same string keys) and a spec dict with three optional parts: 'filter' = [col, op, value] where op is one of '=','!=','>','<','>=','<=' (compare with Python's natural ordering of the stored values); 'project' = list of column names to keep, in that order; 'sort' = [col, 'asc'|'desc']. Apply filter, then sort (stable), then project. Return the resulting list of dicts. Any part may be absent, in which case it is skipped.
run_query(rows: list[dict], spec: dict) → list[dict][[{"id":1,"age":30,"name":"a"},{"id":2,"age":25,"name":"b"},{"id":3,"age":40,"name":"c"}],{"sort":["age","asc"],"filter":["age",">",26],"project":["name","age"]}]out[{"age":30,"name":"a"},{"age":40,"name":"c"}]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.