← Questions

Paint house: cheapest daily colors with no repeat on consecutive days

0
OpenAICodingLast asked Oct 2026

For the next n days a store sells blue, green and red shirts, and you get three cost arrays, one per color, giving each color's price on each day. You buy exactly one shirt every day, but you may not buy the same color on two consecutive days. Return the minimum total cost.

This is the classic "paint house" problem: explain the recurrence, then bring the extra space down to a constant.

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