Stock Purchase and Sell to Maximize Profit in a week in Java
This is a trending problem based on array implementations and is being liked by plenty of the interviewers now a days, I have encountered many times and I also love to ask this problem to the candidates I come across.
Given a list containing future predictions of share prices, find the maximum profit earned by buying and selling using 1 transaction.
Sample input : [3,5,2,6,9,1,4]
Sample output : 7