836

Largest Submatrix
Type:
Matrix
Diff: 5.0

Tricks

Check all possible sub-matrix for the largest one. For doing this, you need many nested loops like the following.
 
for(i=0;i<n;i++)                    ///
{                                             /// claculation start position
          for(j=0;j<n;j++)        ///
          {
                        for(int k=0;(k+i)<n;k++) ///row count
                        {
                                        for(int l=0;((l+j)<n) && t;l++)///coloumn count
                                           {
                                                                  for(int x=0;(x<=k)&& t;x++)
                                                                  {
                                                                   ...... .......
                                                                   ...... .......
                                                                   ...... .......
                                                                   ...... .......
                                                                   }
                                             }
                         }
             }
}
 
This brute force approach can solve this problem within its time limit. 

Related Problems & Topics

108 Maximum Sum

If you have any advice, complements 

or proposal, please  Send mail to Author

Submit

 

1