Java program to color a grid such that all same color cells are connected either horizontally or vertically
import java . util . * ; class GFG { static void solve ( List < Integer > arr , int r , int c ) {