Making all possible horizontal cuts , one by one and calculating the sum of minimum invalid area for both the resulting pieces
for ( int i = 1 ; i < b ; i ++ ) { ans = min ( ans , minInvalidAreaUtil ( l , i ) + minInvalidAreaUtil ( l , b - i ) ) ; }