leetcode
121. Best Time to Buy and Sell Stock
Solution
Java code
Python code
Time complexity: O(n)
Space complexity: O(1)