buy-sell stock, O(n) time and O(1) space algorithm