Number of ways to paint 3 X N grid with 3 colors

https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid/

看上面的解法就能推导出来,code部分其实简单。就是对于三种color来说,每一个column只有两种pattern

(1) 121

(2) 123

Last updated