Minimum Cost to Color a Row of Houses

Asked at Shopify · Coding Questions · Difficulty: Medium · Last asked Aug 29, 2025

A street has `n` houses in a row, and every house must be painted with exactly one of three colors, numbered 0, 1 and 2. Painting house `i` with color `j` costs `costs[i][j]`. Two neighboring houses may not share a color. Find the lowest total cost to paint every house.

Loading the problem…