Top Algorithm Interview Questions Fully Explained: Best time to Buy and Sell Stock
Автор: Jadi
Загружено: 2024-08-27
Просмотров: 307
We have a list of a stock price on each day and we can buy on a specific day and sell on a day in the future, target is clear: maximize the profit!
I will start by showing you a "bad" solution and analyzing why its bad! This leads us to a practical introduction to the BIG O notation. Then we will look for a better solution which satisfies our interviewer.
00:00 - Buy and sell stock algorithm
02:19 - Ugly O(n^2) solution with nested fors
03:24 - Why O(n^2) is bad; a javascript sample
09:00 - A good solution for stock buy and sell question
Question on leetcode: https://leetcode.com/problems/best-ti...
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: