Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Number of Ways to Paint N x 3 Grid
Bookmark
Brute Force
Pattern DP
Input
n = 1
n = 2
n = 3
n = 5
Custom
n
=
5
Valid Row Patterns
Valid Row Patterns
Valid Row Patterns
(2,1,0) is a valid row
010
1
012
1
020
1
021
1
101
1
102
1
120
1
121
1
201
1
202
1
210
1
Valid Row Patterns
120 can sit above 012
010
012
2
020
021
101
102
120
121
201
202
210
212
Valid Row Patterns
120 shares a column with 021
010
012
020
021
1
101
102
120
121
201
202
210
212
Valid Row Patterns
101 shares a column with 102
010
012
020
021
101
102
3
120
121
201
202
210
212
Valid Row Patterns
120 shares a column with 121
010
012
020
021
101
102
120
121
2
201
202
210
212
Valid Row Patterns
102 shares a column with 202
010
012
020
021
101
102
120
121
201
4
202
3
210
212
Valid Row Patterns
102 shares a column with 212
010
012
020
021
101
102
120
121
201
202
210
4
212
3
Valid Row Patterns
Pattern 201 reaches 18 ways
010
23
012
18
020
23
021
18
101
23
102
18
120
18
121
23
201
18
202
5
210
4
212
5
Valid Row Patterns
5118 colourings in total
010
479
012
374
020
479
021
374
101
479
102
374
120
374
121
479
201
374
202
479
210
374
212
479
algo
master
.
io
Step:
An 5 x 3 grid. Count the colourings where no two neighbours share a colour.
0 / 297
Input
n = 1
n = 2
n = 3
n = 5
Custom
n
=
5
0 / 297
algo
master
.
io
Step:
An 5 x 3 grid. Count the colourings where no two neighbours share a colour.