← Questions

House robber IV: smallest possible maximum over k non-adjacent picks

0
MicrosoftCodingLast asked Sep 2026

A row of houses (or servers) each holds a value. Choose at least k of them with no two next to each other. Among all valid choices, make the largest chosen value as small as possible and return it. Explain the binary search on the answer with a greedy check, and why the greedy pick is safe.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding