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:
parent
3abee3373c
commit
4d2d19f136
2 changed files with 55 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue