上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2021-07-27 19:44 三一一一317 阅读(36) 评论(0) 推荐(0)
摘要: class Solution { public: bool check(int s[], int p[]) { for (int i = 0; i < 26; i++) { if (s[i] != p[i]) { return false; } } return true; } vector<int 阅读全文
posted @ 2021-07-27 18:29 三一一一317 阅读(27) 评论(0) 推荐(0)
摘要: 指针是c和c++一个十分重要的概念,一个数据对象的内存地址称为该数据对象的指针。指针可以表示各种数据对象,允许直接获取和操作数据地址,实现动态存储分配。 面试问题一: 指针和引用的区别 (1)非空区别。在任何情况下都不能使用指向控制的引用。一个引用必须总是指向某些对象。 (2)合法性区别。在使用引用 阅读全文
posted @ 2021-07-27 12:03 三一一一317 阅读(62) 评论(0) 推荐(0)
摘要: 函数的调用,想必大家都用过,一个函数在被另一个函数调用的时候,才有生命,才会为其准备对应的内存空间,再调用完毕之后再清理释放结束。 可以看到,每一次的函数调用都会带来一些时间和空间上的花销。 而自定义函数的一个作用,也是为了提高代码的重用性,可以在需要的时候随时调用,提高开发效率。那么,一个代码本身 阅读全文
posted @ 2021-07-27 10:45 三一一一317 阅读(293) 评论(0) 推荐(0)
摘要: class Solution { public: int res = 0; int findTargetSumWays(vector<int>& nums, int target) { if(nums.size()==0) return 0; dfs(nums,0,0,target); return 阅读全文
posted @ 2021-07-26 17:34 三一一一317 阅读(24) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2021-07-26 16:57 三一一一317 阅读(33) 评论(0) 推荐(0)
摘要: 解析参考: https://leetcode-cn.com/problems/task-scheduler/solution/tong-zi-by-popopop/ class Solution { public: /* 结合桶的思想,我们只需要计算两个数,第一:一个是找出最大任务数量 N, 看一下 阅读全文
posted @ 2021-07-26 16:29 三一一一317 阅读(37) 评论(0) 推荐(0)
摘要: class Solution { public: int hammingDistance(int x, int y) { int res = x^y; // 异或不同为结果为1 unsigned int flag = 1; int count = 0; while(flag){ if(flag&re 阅读全文
posted @ 2021-07-25 14:52 三一一一317 阅读(26) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2021-07-25 14:39 三一一一317 阅读(33) 评论(0) 推荐(0)
摘要: 前缀和与哈希表 // class Solution { // public: // int subarraySum(vector<int>& nums, int k) { // // 前缀和 // // 超时 // vector<int> pre(nums.size()+1,0); // pre[0 阅读全文
posted @ 2021-07-25 14:19 三一一一317 阅读(25) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 23 下一页