# Thread: maximum sum of subarray

1. ## maximum sum of subarray

Given a M × M array of positive and negative integers, find the sub-rectangle with the largest sum. A sub-rectangle is any contiguous sub-array of size 1 × 1 or greater located within the whole array. The sum of a rectangle is the sum of all the elements in that rectangle. The input to the program is the value of M followed by the array itself.
Input:
First line contains M ( 1 <= M<= 100 )
Next M lines contains M elements each, describing the matrix A ( -100 <= A[i][j] <= 100 )
Output:
The Maximum Sum (Followed by a '\n' which is just for a newline, no need to display)
Sample Cases:
Input:
4
0 -2 -7 0
9 2 -6 2
-4 1 -4 1
-1 8 0 -2
Output:
15
how to solve this one!!!

2. With fgets i said on the other post you read every line in an array.Then from the array retrieve the numbers.They are seperated by a white space.In order to read M use scanf.However,everybody tells you to first write your own try(code or/and idea) but you do not follow their advice

3. Originally Posted by std10093
With fgets i said on the other post you read every line in an array.Then from the array retrieve the numbers.They are seperated by a white space.In order to read M use scanf.However,everybody tells you to first write your own try(code or/and idea) but you do not follow their advice
i have my own idea ...but trying to get some more ways to solve the problem so that i can choose a optimal one...thats it....and for the other problems first i gave the algorithm...
anyways thanku for the suggestion :-)

4. std10093 is right ... all your initial posts so far ask "how to solve it?":

pipelining

hey i ahve assigned to implement a shell...implementing it in C language.but now got stuck on pipelinig...kindly help me guys...
if possible send the code so that i can get some idea for example that run ls|wc

how to solve this problem

You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.
Each digit is allowed to occur in the number the same number of times it occurs in the set.

permutation of strings

if one string is permutation of other ....
how to solve it???

maximum sum of subarray

...
how to solve this one!!!
If you really have your own idea for this one, post it and let others comment on how you can improve it. Don't expect everyone to just put up their own ideas (read: do your work for you) so you can "choose an optimal one."

Show us what you have so far and we can proceed from there.

5. Try implementing this and come back to us if you get stuck.

UVa 108 - Algorithmist

6. Good catch, Matticus.
Students are expected to solve the problem first, then code it.
So it's less of a programming problem and more of a devise an algorithm problem.
The good helpers on this forum are duped into solving a C issue even though we are not even coding yet.