Use Kadane's algorithm to solve this with time complexity O(n) and Space O(1) http://www.algorithmist.com/index.php/Kadane's_Algorithm
Need to modify a bit. -- Regards, Sachin Chitale Application Engineer SCJP, SCWCD Contact# : +91 8086284349, 9892159511 Oracle Corporation On Tue, Nov 20, 2012 at 10:43 PM, Koup <[email protected]> wrote: > Consider an array of N integers. Find the longest contiguous subarray > so that the average of its elements is greater than a given number k > > I know the general brute force solution in O(N^2). Is there any > efficient solution using extra space? > > -- > > > --
