Largest rectangle of 1’s with swapping of columns allowed
Submissions: 1359   Accuracy:

43.15%

  Difficulty: Hard   Marks: 8

Given a matrix with 0 and 1’s, find the largest rectangle of all 1’s in the matrix. The rectangle can be formed by swapping any pair of columns of given matrix.

Input:

The first line of input contains an integer T denoting the number of test cases. 

First line of each test case contains two elements R and C.The following line contains R*C numbers each (representing the matrix).
Output:

print the max area in a new line for each test case.
Constraints:

1<=T<=100

1<=R,C<=15
Example:

Input:

2

2 3

1 1 1 0 1 1

2 2

1 0 1 1

Output:

4

2

** For More Input/Output Examples Use 'Expected Output' option **

Author: bhawnamait


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.