Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 276. Paint Fence
Count the number of ways to paint n fence posts with k colors such that no more than two adjacent posts have the same color. This is a dynamic programming problem where you derive a recurrence by tracking configurations that end with the same color as the previous post versus a different color.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Early February, 2025
Amazon
Mid-level
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.