Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int fun(int r,int c,int arr[])
- {
- int maxr=INT_MIN,maxc=INT_MIN;
- for(int i=0;i<r;i++)
- {
- int curr=0;
- for(int j=0;j<c;j++)
- {
- curr+=arr[i*c+j];
- }
- maxc=max(maxc,curr);
- }
- for(int j=0;j<c;j++)
- {
- int curr=0;
- for(int i=0;i<r;i++)
- {
- curr+=arr[i*c+j];
- }
- maxr=max(maxr,curr);
- }
- return maxr+maxc;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement