Golang DP solution
go\nfunc colorTheGrid(m int, n int) int {\n\tbase := make([]int, 0, m)\n\tfor i := 1; i <= 3; i++ {\n\t\tbase = append(base, i)\n\t}\n\tfor i := 2; i <= m; i++ 
```go\nfunc colorTheGrid(m int, n int) int {\n\tbase := make([]int, 0, m)\n\tfor i := 1; i <= 3; i++ {\n\t\tbase = append(base, i)\n\t}\n\tfor i := 2; i <= m; i++ {\n\t\tnewBase := make([]int, 0, 64)\n\t\tfor _, v := range base {\n\t\t\tfor j := 1; j <= 3; j++ {\n\t\t\t\tif j == v%10 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnewBase = append(newBase, v*10+j)\n\t\t\t}\n\t\t}\n\t\tbase = newBase\n\t}\n\tmapping := make(map[int][]int, len(base))\n\tfor _, vf := range base {\n\tloop:\n\t\tfor _, vt := range base {\n\t\t\tdiv := 1\n\t\t\tfor i := 0; i < m; i++ {\n\t\t\t\tif (vf/div)%10 == (vt/div)%10 {\n\t\t\t\t\tcontinue loop\n\t\t\t\t}\n\t\t\t\tdiv *= 10\n\t\t\t}\n\t\t\tmapping[vf] = append(mapping[vf], vt)\n\t\t}\n\t}\n\tdp := make(map[int]int, len(mapping))\n\tfor k := range mapping {\n\t\tdp[k] = 1\n\t}\n\tfor i := 1; i < n; i++ {\n\t\tnext := make(map[int]int, len(mapping))\n\t\tfor k, vs := range mapping {\n\t\t\tfor _, v := range vs {\n\t\t\t\tnext[k] += dp[v]\n\t\t\t}\n\t\t\tnext[k] %= 1000000007\n\t\t}\n\t\tdp = next\n\t}\n\ttotal := 0\n\tfor _, v := range dp {\n\t\ttotal = (total + v) % 1000000007\n\t}\n\treturn total\n}\n```
['Dynamic Programming', 'Go']