Solve the stock buying problem with a more simpler solution, still an O(n) solution but it is much simpler to implement.