摘要:
##06. 从尾到头打印链表 class Solution { public: //两个指针一起走 一次翻转一个方向 最后head.next =null ListNode* reverse1(ListNode *head){ if(!head)return NULL; auto a=head,b=h 阅读全文
posted @ 2022-04-13 10:04
liv_vil
阅读(21)
评论(0)
推荐(1)
摘要:
##09. 用两个栈实现队列 没啥意思 不要想复杂了 就是暴力 class CQueue { public: CQueue() { } /* 一个主栈 一个缓存栈 来回导 得到队头 copy后一端变空了 */ stack<int>stk,cache; void copy(stack<int>&a,s 阅读全文
posted @ 2022-04-13 09:38
liv_vil
阅读(17)
评论(0)
推荐(0)