Method
maxArea
(int M[][], int m, int n)
Source from the content-addressed store, hash-verified
| 40 | } |
| 41 | |
| 42 | public int maxArea(int M[][], int m, int n) { |
| 43 | // add code here. |
| 44 | int res=0; |
| 45 | int arr[] = new int[n]; |
| 46 | |
| 47 | // Traverse the matrix |
| 48 | for(int i=0;i<m;i++) |
| 49 | { |
| 50 | for(int j=0;j<n;j++) |
| 51 | { |
| 52 | if(M[i][j]==0) |
| 53 | { |
| 54 | arr[j]=0; |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | arr[j] = arr[j] + M[i][j]; |
| 59 | } |
| 60 | } |
| 61 | // Calculate result so far |
| 62 | res=Math.max(res,findMax(arr,n)); |
| 63 | } |
| 64 | return res; |
| 65 | } |
| 66 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected