Memoized filter ignores dependency
An AI added useMemo to 'optimize' an expensive filtered list. Users report the filter sometimes ignores the latest search term. What's the bug?
Implement
filtered_counts(rows: list[str], searches: list[str], deps_include_search: bool) → list[int]Examples
in
[["Ada","Alan","Grace"],["","A","Ala"],true]out[3,2,1]in
[["Ada","Alan","Grace"],["","A","Ala"],false]out[3,3,3]in
[["abc"],["b","z"],true]out[1,0]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 16 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.