-
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
Best Time to Buy and Sell Stock - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
왼쪽에서 오른쪽으로 순차적으로 탐색하면서, Math.min은 가장 작은 값을, Math.max는 가장 큰 값을 선택하게 한다.
'알고리즘 > 리트코드' 카테고리의 다른 글
152. Maximum Product Subarray (0) 2021.05.23 53. Maximum Subarray (0) 2021.05.23 1557. Minimum Number of Vertices to Reach All Nodes (0) 2021.05.20 1277. Count Square Submatrices with All Ones (0) 2021.05.20 1641. Count Sorted Vowel Strings (0) 2021.05.20 댓글