Code RoomC to Rust unsafe port
HardPrep Room Coding #5001

C to Rust unsafe port

Vibe & agenticCode quality & reviewSenior–Staff~28 min

Your team wants to incrementally port a performance-critical C image-decoding library to Rust for memory safety, using an AI agent to translate functions. The agent produces Rust that compiles, but it's full of `unsafe` blocks and raw pointer arithmetic mirroring the C. How do you direct the agent and structure the port so you actually gain the safety you're migrating for, and how do you verify the Rust decodes identically to the C?

Implement
decode_rle_row(codes: list[int], width: int) → list[int]
Examples
in[[3,7,2,9],8]out[7,7,7,9,9,0,0,0]
in[[5,1,5,2],6]out[1,1,1,1,1,2]
in[[],4]out[0,0,0,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 28 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.