Code Room
Vibe codingMediumvc-g510
Subject Ai code reviewLevel Mid–Senior~17 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

This Lambda (Python) was generated to resize every image in an uploaded album. It works for small albums and times out for large ones, leaving the album half-processed. Diagnose the design flaw and propose a fix.

python
def handler(event, context):    album_id = event["album_id"]    keys = list_album_objects(album_id)  # can be thousands    for key in keys:        img = download(key)        thumb = resize(img, 256)        upload(thumbnail_key(key), thumb)    mark_album_ready(album_id)    return {"processed": len(keys)}
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.

Describe your solution

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.

Run or narrate your approach, then ask the coach.