Sponsored
Use these hints if you're stuck. Try solving on your own first.
Represent each colored column by a bitmask based on each cell color.
Use bitmasks DP with state (currentCell, prevColumn).
Solve with full IDE support and test cases