iT邦幫忙

2025 iThome 鐵人賽

DAY 10
0

題目介紹

  • 編號:121
  • 類型:Array,, Greedy
  • 難度:medium
  • 題目連結:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
  • 描述:給一個陣列prices,表示某支股票每天的價格。請找出一個「買進與賣出」的時機(買在前、賣在後),使能獲得最大利潤。若無法獲利,則回傳 0。

解題成功畫面截圖:
https://ithelp.ithome.com.tw/upload/images/20250924/20178840yLqTtRa3fx.jpg

notion筆記截圖:
https://ithelp.ithome.com.tw/upload/images/20250924/20178840fE6gH6O7tM.jpg
https://ithelp.ithome.com.tw/upload/images/20250924/20178840FGxuPsBx6A.jpg


上一篇
<DAY9> - Reverse String
下一篇
<DA11> - Ransom Note
系列文
「用 LeetCode 挑戰 30 天,打造扎實的程式邏輯力」- 結合Notion記錄學習筆記13
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言