I want easy algorithm with minimum order to get the sub-rectangle with the largest sum in an array
for example
array as a input
0 -2 -7 0
9 2 -6 2
-4 1 -4 1
-1 8 0 -2

sub-rectangle
9 2
-4 1
-1 8

maximum sum of its sub-rectangle is : 30

Please I want the idea of this problem beacuse I think too much but I didn't reach to nothing

After thinking long, I found that this sub-rectangle may be include the largest positive number in array but what's the solution if in this sub-rectangle may include negative numbers the maximum of it may largest than the Positive numbers in this sub-rectangle .
sorry for the long thread
thanks,

Recommended Answers

All 4 Replies

sub-rectangle
9 2
-4 1
-1 8

maximum sum of its sub-rectangle is : 30

Please explain how you get the sum of 30 from these 6 numbers.
Normal math gives me 15.

I'm so sorry the maximum sum is 15.

Only post in one forum. Preferably, the correct one... like CS if you need help with an algorithm. Multiple posts means no more help from me.

ok , I don't make it again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.