iT邦幫忙

2025 iThome 鐵人賽

DAY 14
0

題目介紹:

  • 編號:155
  • 類型:Design, Stack
  • 難度:medium
  • 題目連結:https://leetcode.com/problems/min-stack/description/
  • 描述:設計一個支援以下操作的最小堆疊:
  1. push(x) — 將元素 x 推入堆疊
  2. pop() — 移除堆疊頂元素
  3. top() — 取得堆疊頂元素
  4. getMin() — 取得堆疊中的最小值

解題成功的截圖:
https://ithelp.ithome.com.tw/upload/images/20250928/201788406pk32pK78M.jpg

notion筆記截圖:
https://ithelp.ithome.com.tw/upload/images/20250928/201788406QOfiWHFfc.jpg
https://ithelp.ithome.com.tw/upload/images/20250928/201788402yklFWGcGN.jpg


上一篇
<DAY13> - Implement Queue using Stacks
下一篇
<DAY15> - Fibonacci Number
系列文
「用 LeetCode 挑戰 30 天,打造扎實的程式邏輯力」- 結合Notion記錄學習筆記19
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言