力扣刷题
Tulpen1
这个作者很懒,什么都没留下…
展开
-
第 1 天 栈与队列(简单)(之前的记录全没了,重新备份)
题目01: class MinStack { public: /** initialize your data structure here. */ stack<int>stack1; stack<int>stack2; MinStack() { } void push(int x) { stack1.push(x); if(stack2.empty() || stack2.原创 2021-09-05 15:22:48 · 74 阅读 · 0 评论 -
剑指offer 35.复杂链表的复制(C++实现)
剑指offer 35.复杂链表的复制(C++实现) //Definition for a Node class Node{ public: int val; Node* next; Node* random; Node(int _val){ val = _val; next = NULL; random = NULL; } }; 利用哈希map实现代码: class Solution{ public: Node* copyRandomList(Node* head){ if(h原创 2021-09-02 21:44:14 · 129 阅读 · 0 评论