Here\'s an interview questions that a colleague asked for a programming position. I thought this was great for watching the interviewee think it through. I\'d love to get re
Try this code .. it would work fine for at least one +ve number in the array.. O(n) just one for loop used..
public static void main(String[] args) {
int length ;
int a[]={-12, 14, 0, -4, 61, -39};
length=a.length;
int absoluteMax=0, localMax=0, startIndex=0, lastIndex=0, tempStartIndex=0;
for (int index=0;index