Largest Submatrix With Rearrangements
You receive a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order.
Find and provide the area of the largest submatrix within matrix where every element of the submatrix is 1 after reordering the columns optimally.

Input: matrix = [[0,0,1],[1,1,1],[1,0,1]]
Output: 4
Explanation: You can rearrange the columns as shown above.
The largest submatrix of 1s, in bold, has an area of 4.

Input: matrix = [[1,0,1,0,1]]
Output: 3
Explanation: You can rearrange the columns as shown above.
The largest submatrix of 1s, in bold, has an area of 3.
Input: matrix = [[1,1,0],[1,0,1]]
Output: 2
Explanation: Notice that you must rearrange entire columns, and there is no way to make a submatrix of 1s larger than an area of 2.
Constraints
m == matrix.lengthn == matrix[i].length1 <= m * n <= 10^5matrix[i][j]is either0or1.
Did this problem appear in one of your interviews?
Responses stay private.
