[LeetCode] Paint Fence

1 · · Feb. 21, 2022, 9:12 a.m.
276. Paint Fence You are painting a fence of n posts with k different colors. You must paint the posts following these rules: Every post must be painted exactly one color. There cannot be three or more consecutive posts with the same color. Given the two integers n and k, return the number of ways you can paint the fence. ...