随笔分类 -  剑指offer

摘要:1:剑指 Offer 03. 数组中重复的数字 有的思路会是自己想的有的是参考别人的思路 #include<set> class Solution { public: int findRepeatNumber(vector<int>& nums) { // 两个方案,一个是用set 时间复杂度 O( 阅读全文
posted @ 2021-02-14 21:50 rollupbytian 阅读(111) 评论(0) 推荐(0)
摘要:主要是对random进行赋值。 1:可以使用map将旧节点和新节点对应起来,然后进行赋值 2:首先对map进行赋值,其次对next和random进行赋值 注意点:第二次循环的时候,将cur赋值为head /* // Definition for a Node. class Node { public 阅读全文
posted @ 2020-11-30 14:14 rollupbytian 阅读(76) 评论(0) 推荐(0)