HARDasked at 1 company

Paint House III

A hard-tier problem at 61% community acceptance, tagged with Array, Dynamic Programming. Reported in interviews at PayPal and 0 others.

Founder's read

Paint House III is the follow-up that nobody sees coming. You've probably nailed the original Paint House problem, so you walk in confident. Then the OA throws this at you: you've got houses, multiple colors per house, a budget constraint, and a neighborhood preference rule baked in. PayPal asks this one. The acceptance rate sits around 61 percent, which sounds forgiving until you realize most people who fail it don't recognize the DP state early enough. By the time they're halfway through coding, they've already painted themselves into a corner. StealthCoder solves it in seconds if you blank during the live assessment.

Companies asking
1
Difficulty
HARD
Acceptance
61%

Companies that ask "Paint House III"

If this hits your live OA

Paint House III is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.

Get StealthCoder
What this means

The trap is thinking this is just Paint House with extra variables bolted on. It's not. The key insight is that your DP state needs to track three dimensions: which house, which color you picked for it, and how many color changes you've made so far. That third dimension is what kills people. You can't just track house and color like the original problem. The neighborhood rule (no two adjacent houses same color) plus the budget limit (max k color changes) forces you to bake the change count into your state itself. Once you see that, the recurrence is straightforward: for each house and each valid color, iterate through the previous house's colors, count the change if needed, and check your budget. The common fail is either ignoring the color-change cost in the DP formulation or using a 2D state when you need 3D. If you hit this problem live and freeze on state design, StealthCoder surfaces the correct DP structure and a working solution immediately.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Paint House III recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Paint House III interview FAQ

Is Paint House III actually harder than the first two versions?+

Yes, significantly. The acceptance rate of 61 percent reflects that the state space is more complex. The first version is greedy-ish; this one demands you track color changes in the DP state itself. Many candidates misjudge the dimensionality needed and rewrite mid-interview.

What's the actual trick most people miss?+

The third DP dimension. People try to solve it with just house and color, forgetting that the budget constraint (k color changes) must live inside the state. Once you add that dimension, the recurrence becomes clear, but designing the state correctly is where most people stumble.

Does PayPal really ask this, or is it just a LeetCode flex?+

PayPal has reported this problem. It's not a common warm-up. If you see it on their OA, it's late-round or a deliberate hard filter. The acceptance rate suggests they're using it to separate strong DP practitioners from people who've only drilled the easier versions.

How does the neighborhood constraint change the approach?+

It forces you to iterate through all previous colors when building your current house's DP values. Combined with the color-change tracking, this makes the recurrence O(n * m^2 * k) in the worst case. The constraint isn't the hard part; managing state dimensions around it is.

Should I memorize the DP formulation or learn the pattern?+

Learn the pattern: multi-dimensional DP for constrained painting problems. Understand why you need three dimensions here (house, color, change count). That pattern transfers. Memorizing the exact recurrence is secondary if you understand the state design.

Want the actual problem statement? View "Paint House III" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.