Paint House
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A street has n houses in a row, and each must be painted red, blue, or green. Painting house i with color j costs costs[i][j] (column 0 = red, 1 = blue, 2 = green).
No two neighboring houses may share a color. Return the minimum total cost to paint every house under that rule.
Aim for O(n) time and O(1) extra space.
Examples
Constraints
- `n == costs.length`
- `1 <= n <= 100`
- `costs[i].length == 3`
- `0 <= costs[i][j] <= 20`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.