Best Time to Buy and Sell Stock
In Given array, the ith element is stock value of ith day. We can only one time buy or sale, find maximum profit.
Latest Source Code:
Github: BuySellStock.java
Output:
Array: [7, 1, 5, 3, 6, 4] Maximum profit : 5
Latest Source Code:
Github: BuySellStock.java
Output:
Array: [7, 1, 5, 3, 6, 4] Maximum profit : 5