Leetcode 265. Paint House II
Given n houses and k paint colors with a cost matrix, choose a color for each house so no two adjacent houses share a color and the total painting cost is minimized. The challenge is to design an efficient DP that handles large k (avoid naive O(n·k²)), typically by carrying forward the best and second-best previous costs to achieve O(n·k) time.
Asked at:
LinkedIn
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Late February, 2026
Senior
Mid February, 2026
Senior
Late August, 2025
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.