From: Paul Novak Date: 2007-07-14T00:42:08+09:00 Subject: Re: Maximum Sub-Array (#131) On Jul 13, 10:29 am, Ruby Quiz wrote: > The three rules of Ruby Quiz: > > 1. Please do not post any solutions or spoiler discussion for this quiz until > 48 hours have passed from the time on this message. > > 2. Support Ruby Quiz by submitting ideas as often as you can: > > http://www.rubyquiz.com/ > > 3. Enjoy! > > Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone > on Ruby Talk follow the discussion. Please reply to the original quiz message, > if you can. > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > by Harlan > > Given an array of integers, find the sub-array with maximum sum. For example: > > array: [-1, 2, 5, -1, 3, -2, 1] > maximum sub-array: [2, 5, -1, 3] > > Extra Credit: > > Given a matrix of integers, find the rectangle with maximum sum. Nice quiz. One question. For an array containing all negative integers, is the maximimum sub- array an empty array or a single-value array containing the highest value? For example: array: [-1,-2,-3] maximum sub-array: [] or [-1] ? Regards, Paul.