Re: [閒聊] 每日LeetCode

看板Marginalman作者 (廷廷)時間4月前 (2024/01/29 15:02), 編輯推噓3(302)
留言5則, 5人參與, 4月前最新討論串630/719 (看更多)
寫完後發現去年5月寫過了 那時候應該是抄某個答案的 結果我一年後再寫一遍 一模一樣 答案直接背起來 笑死 class MyQueue { public: stack<int> in; stack<int> out; MyQueue() { } void push(int x) { in.push(x); } int pop() { if(out.empty()){ while(!in.empty()){ out.push(in.top()); in.pop(); } } int top = out.top(); out.pop(); return top; } int peek() { if(out.empty()){ while(!in.empty()){ out.push(in.top()); in.pop(); } } int top = out.top(); return top; } bool empty() { return in.empty() && out.empty(); } }; -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.230.51.220 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1706511744.A.1AF.html

01/29 15:03, 4月前 , 1F
你好棒
01/29 15:03, 1F

01/29 15:03, 4月前 , 2F
你好厲害
01/29 15:03, 2F

01/29 15:03, 4月前 , 3F
大師
01/29 15:03, 3F

01/29 15:27, 4月前 , 4F
大濕...
01/29 15:27, 4F

01/29 16:47, 4月前 , 5F
不是背起來 是你變強了
01/29 16:47, 5F
文章代碼(AID): #1bjqs06l (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1bjqs06l (Marginalman)