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.
Asked by: sharshach on Sept. 18, 2019, 8:48 p.m. Last updated on May 28, 2021, 7:14 a.m.
This question is based on chromatic coloring of graphs which is still a topic under research. Here's a brute force approach.
These might be helpful: Discussion, Solutions.