Code Room
Code reviewHardcr-g285
Subject Quadratic loopsLevel Mid–Senior~20 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Python function that prunes archived items from an in-memory list. Profiling shows it dominates a nightly job when the list has hundreds of thousands of items.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
def prune_archived(items):    for item in list(items):        if item.archived:            items.remove(item)    return items
Run or narrate your approach, then ask the coach.