力扣小白刷題之155題最小棧

題目描述 設計一個支持 push、pop、top 操作,並能在常數時間內檢索到最小元素的棧。 push(x) — 將元素 x 放入棧中 pop() — 刪除棧頂的元素 top() — 獲取棧頂元素 getMin() — 檢索棧中的最小元素 注意: pop top getMin 操作總是在 非空棧 上調用 參考自:https://leetcode-cn.com/problems/min-stack/
相關文章
相關標籤/搜索