How about the following way.. where you can save some space.
but before that.. you meant, your application will need O(n) space for the 
recursion only right?
 
in that case, instead of the recursion, try this approach.
set start, length = 0,
tempStart, tempLenght =0
 
set tempStart = i_value
increase tempLenght for every negative number until you find a positive 
number, 
 
when positive, check tempLength & lenght and assign the set the length, 
start accordingly.
and set tempStart,tempLength to 0 and go until the end.
 
returning the value.
sizeOfArray*start + length
 
u can extract these two in main and print.
 
 
return the following things, 

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to