上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 87 下一页
摘要: 暴力去重 class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { map<int, int> cnt; int n = nums.size(); for(int i = 0; i < n; i++) { i 阅读全文
posted @ 2022-03-30 00:20 WTSRUVF 阅读(58) 评论(0) 推荐(0)
摘要: 水题,vis记录,暴力即可 注意有重复 class Solution { public: vector<int> twoSum(vector<int>& numbers, int target) { int len = numbers.size(); int vis[3001]; memset(vi 阅读全文
posted @ 2022-03-29 00:07 WTSRUVF 阅读(33) 评论(0) 推荐(0)
摘要: 去重,然后暴力即可,去重时别忘了记录原来的长度 class Solution { public: int max(int a, int b) { return a > b ? a : b; } int maxProduct(vector<string>& words) { int len = wor 阅读全文
posted @ 2022-03-28 23:43 WTSRUVF 阅读(49) 评论(0) 推荐(0)
摘要: map就可以 O(n) 不适用额外空间: int有32位,求每一位的二进制的累加和 因为除了那个特殊数,其他数都出现三次 那么只要一个数x,二进制的某一位为1,这一位就是 += 3 最后将结果%3,就是特殊数在这个位上的数 不适用额外的空间: 外层循环是32 内层遍历nums 提一句: 其实这样的话 阅读全文
posted @ 2022-03-28 08:57 WTSRUVF 阅读(43) 评论(0) 推荐(0)
摘要: 递推就好了 所有2的次方均只有1个1 以每个2的次方为一段 遍历i从2到n temp为当前不大于i的最大的2的次方 ret[i] = ret[temp] + ret[i - temp] class Solution { public: vector<int> countBits(int n) { i 阅读全文
posted @ 2022-03-27 23:56 WTSRUVF 阅读(53) 评论(0) 推荐(0)
摘要: 嗯。。。用的加法,注意a为最大值 b为1或者-1,还有a为负数最小值就行 也可以用位运算 << 相当于 * 2呗 其他的可以用sum + sum <= abs(a) 来优化 class Solution { public: int divide(int a, int b) { long long A 阅读全文
posted @ 2022-03-27 23:26 WTSRUVF 阅读(42) 评论(0) 推荐(0)
摘要: pcl库下载地址:https://github.com/PointCloudLibrary/pcl/releases 请下载以下两个文件 PCL-1.12.0-AllInOne-msvc2019-win64.exe pcl-1.12.0-rc1-pdb-msvc2019-win64.zip 直接运行 阅读全文
posted @ 2022-03-27 10:38 WTSRUVF 阅读(1128) 评论(0) 推荐(0)
摘要: 水题 n方即可 class Solution { public: string convert(string s, int numRows) { if (numRows == 1) return s; int len = s.length(); int cnt = 0; int str[1001][ 阅读全文
posted @ 2022-03-24 17:32 WTSRUVF 阅读(74) 评论(0) 推荐(0)
摘要: 一、在C#中调用点云库PCL 自己做项目一直使用的C#,用来写界面也比较方便。由于需要做3D点云数据处理方面的操作,用到了开源库PCL,但是PCL点云库是用C++写的。自己封装来实现调用确实是一种比较靠谱的方法,但对于时间成本来说较高。在网上找了一圈,Justin Bruening已经在对于PCL中 阅读全文
posted @ 2022-03-23 09:31 WTSRUVF 阅读(4980) 评论(0) 推荐(0)
摘要: 用的Manacher class Solution { public: string init(string s) { string str = "$"; int len = s.length(); for(int i = 0; i < len; i++) str += "#", str += s[ 阅读全文
posted @ 2022-03-21 00:16 WTSRUVF 阅读(54) 评论(0) 推荐(0)
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 87 下一页