Function to find the number of ways to cut the matrix into the K parts such that each part have atleast one filled cell
static int ways ( int [ ] [ ] arr , int K ) { int R = arr . length ; int C = arr [ 0 ] . length ; int [ ] [ ] preSum = new int [ R ] [ C ] ;