Painting a Grid With Three Different Colors | Leetcode 1931 | DP Bitmasking