I'm going to spend 1-2 hours/day solving different algorithms. More about this here.
Write an efficient method that takes stock_prices and returns the best profit you could have made from one purchase and one sale of one share of Apple stock yesterday.
For example: stock_prices = [10, 7, 5, 8, 11, 9] get_max_profit(stock_prices) # returns 6 (buying for $5 and selling for $11)
No "shorting"—you need to buy before you can sell. Also, you can't buy and sell in the same time step—at least 1 minute has to pass.
If you want to follow along, feel free to post your answers below.
Throughout the last year, I have worked part-time as a working student and also studied at the university. I was not the first and not the last one who has combined that during their studies, but the problem for me was, that at the end of the day I have felt absolutely exhausted mentally and physically. That caused problems with my health and motivation to continue working on my goals or anything. (yeah, “goals,” I wish I had something more specific at that time).