Let's figure out when to buy some stocks! This should not be used in real life. Now matter how good you think your algorthim is :). I do encourage you to pick a stock that you are interested in and get some historic data to use if you can find any.
So lets imagine we have an array where the ith item is the price of a given stock on day i.
Now since you just started to learn about stocks you are only allowed to complete ONE transaction a day (buy one and sell one share of stock). Develop an algorithm to find the maximum profit.
NOTE:
You cannot sell a stock before you buy one.
Ex
Input: [7,1,5,3,6,4]
Output: 5
Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.
Not 7-1 = 6, as selling price needs to be larger than buying price.
HTML, and CSS files haven't been added. I would like y'all to do this yourself :)
Please use Angular + Loopback if you have taken these courses.
- Graph your array of stock prices
PLEASE do not look for solutions online! This is only hurting yourself and the rest of the team. Please use the README.md file to describe the code so other developers know how everything works and maybe some points on future goals.
- Spend some time reading documentation together! W3Schools
- Make sure that y'all really breakdown these problems into manageable parts that you can solve. It is a lot easier to solve a bunch of tiny problems vs a large one.
- Make sure to use proper styling and to comment your code! Please tab 2, can be set by default!
- Before solving any problem, really breakdown all the rules. Maybe even play a couple games so you can easily describe it.
- Feel free to contact @Sirrele for assistance! I hope y'all have fun doing this together!
- You all will kill it! Ready? Set? GIT FIT COOOOOOOOODE!!!