The problem statement says:-

Calculate the number of ways to color an N * M grid using K colors. Adjacent squares in the grid should have different colors. Squares are considered adjacent if they share an edge.

1 <= N,M <= 8

1 <= K <= 10^9

The problem statement says:-

Calculate the number of ways to color an N * M grid using K colors. Adjacent squares in the grid should have different colors. Squares are considered adjacent if they share an edge.

1 <= N,M <= 8

1 <= K <= 10^9

2 Likes