Solve InterviewCake's stock-price problem

Write a function that returns the maximum profit that a trader could have made
in a day. I solved this using a greedy algorithm which constantly sets the
maximum profit by tracking the lowest price we've encountered.
This commit is contained in:
William Carroll 2020-02-27 15:37:36 +00:00
parent 3abee3373c
commit 4d2d19f136
2 changed files with 55 additions and 1 deletions

View file

@ -10,7 +10,7 @@
** DONE Word Cloud Data
** DONE Top Scores
* Greedy Algorithms
** TODO Apple Stocks
** DONE Apple Stocks
** TODO Highest Product of 3
** TODO Product of All Other Numbers
** TODO Cafe Order Checker