- 博客(2)
- 收藏
- 关注
原创 力扣 reference binding to null pointer of type ‘struct value_type‘报错及STL大小根堆(自用)
背景:剑指40|41题 reference binding to null pointer of type 'struct value_type’报错 编译通过,运行报错且位置在STL文件 原因是在vector为空的时候试图访问vector[0] 剑指41:STL大|小根堆的使用 class MedianFinder { //greaterheap 小根堆 //make_heap(begin(),end(),greater<int>()); //push_
2021-08-09 15:27:18
294
原创 力扣heap-use-after-free报错(自用)
力扣heap-use-after-free报错(自用) 背景:剑指35|37题 编译通过,运行报错且报错位置在return一行; vectornodes;改为 vector<TreeNode*>nodes; 使用TreeNode *p=new TreeNode(); 在堆区申请内存,防止函数调用后局部变量被释放; 剑指35: Node* copyRandomList(Node* head) { if(head==nullptr) return he
2021-07-26 17:10:53
227
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人