摘要:
还是用了暴力算法,因为别的写不出来,效率极低,nnd,贴代码 class Solution { public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { int m = nums1.size(); int n = 阅读全文
posted @ 2021-03-05 20:50
zhaohhhh
阅读(39)
评论(0)
推荐(0)
摘要:
第一个方法,现学现卖,先排序,排完序了再遍历,找没有重复的 class Solution { public: int singleNumber(vector<int>& nums) { sort(nums.begin(),nums.end()); int n = nums.size(); if(n= 阅读全文
posted @ 2021-03-05 17:45
zhaohhhh
阅读(51)
评论(0)
推荐(0)
摘要:
思路是很简单,用了一个哈希表解决了问题,要是隔以前估计真想不出来怎么做。下面上用map的代码 class Solution { public: bool containsDuplicate(vector<int>& nums) { map<int,int> good; int n = nums.si 阅读全文
posted @ 2021-03-05 17:14
zhaohhhh
阅读(44)
评论(0)
推荐(0)

浙公网安备 33010602011771号