Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
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:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late August, 2025
Senior
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.