Think of the negative numbers as consumers from a warehouse and positive numbers as producers from the warehouse. The problem reduces to plotting the inventory (starting from time = 0 to time = n) and then finding the max amplitude over time axis in +ve quadrant of the inventory profile which can be done in O(n).
- [algogeeks] Re: Given an array containing both positive... ricky
- [algogeeks] Re: Given an array containing both pos... Arvind Sharma
- [algogeeks] Re: Given an array containing both... Hemanth
- [algogeeks] Re: Given an array containing ... srinivas karlapudi