algorithms400's blog

By algorithms400, history, 6 years ago, In English

How to find the numbers of ways to fill a grid (3*n)array, with three colors A, B and C.

Under the following constraints:

1) All the n cells of the same row can't have the same color.

2) All the 3 cells of the same column can't have the same color.

Sample input : if n=2, then output or number of ways = 174.

Please explain the approach for this.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?