121. Best Time to Buy and Sell Stock
https://leetcode.com/problems/best-ti...
In This video I have discussed a Naive approach to solve the problem and also have explained the Optimised approach and I have coded the solution in Python
GitHub link - Solution (Python, Java and C++)
https://github.com/c0de-i0/LeetCode-S...
Follow us on
Instagram
Goms - / goms.io
Siva - / siva.io
Linkedin
Goms - / gomathinayagam-avudaikumar-509a7716a
Siva - / sivasubramanian-a-443519225
121. Best Time to Buy and Sell Stock
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.
Tags
#leetcode #interview #interviewpreparation #interviewprep #geeksforgeeks #amazoninterviewpreparation #amazoninterviewquestionsandanswers #mang #faang #fang #google #googleinterview #netflixinterview #hackerrank #leetcodesolutions #leetcodequestions #python #pythonprogramming