diff --git a/exampleSite/content/post/给个offer/index.zh-cn.md b/exampleSite/content/post/给个offer/index.zh-cn.md new file mode 100644 index 0000000..f5574c1 --- /dev/null +++ b/exampleSite/content/post/给个offer/index.zh-cn.md @@ -0,0 +1,62 @@ ++++ +author = "Wxn" +title = "给个offer" +date = "2024-04-24" +description = "Please read me first." +tags = [ + "Dilay", +] +categories = [ + "面试复盘", +] + ++++ + +This article offers a sample of basic Markdown. + + +# 正文开始 + +# 1.41. 包含min函数的栈 + +```cpp +//https://leetcode.cn/problems/bao-han-minhan-shu-de-zhan-lcof/description/ +class MinStack { +public: + /** initialize your data structure here. */ + //1.单调栈 + //2.主栈与辅助栈 + //3.1)push都要插入(如果辅助栈为空,或者辅助栈顶>=x,则辅助栈插入) + //2)pop() 如果辅助栈顶 == 主栈顶,则辅助栈顶弹出,否者就只有主栈弹出 + //3)4)直接返回相应的栈 + MinStack() { + + } + + void push(int x) { + + } + + void pop() { + + } + + int top() { + + } + + int getMin() { + + } +}; + +/** + * Your MinStack object will be instantiated and called as such: + * MinStack obj = new MinStack(); + * obj.push(x); + * obj.pop(); + * int param_3 = obj.top(); + * int param_4 = obj.getMin(); + */ +``` +