Skip to content

W01D5 Problem Solving - Stock Market (Stretch) Assignment

Notifications You must be signed in to change notification settings

saunderst/stockMarket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

stockMarket

W01D5 Problem Solving - Stock Market (Stretch) Assignment

Exercise

Create a function maxProfit, which, given a list of stock prices for a given day, returns the maximum profit that could have been made by buying a stock at the given price and then selling the stock later on. For example if the input is: [45, 24, 35, 31, 40, 38, 11] then your program should return 16 because if you bought the stock at $24 and sold it at $40, a profit of $16 was made and this is the largest profit that could be made. If no profit could have been made, return -1.

About

W01D5 Problem Solving - Stock Market (Stretch) Assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published