首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
AIGC
获赞
540
粉丝
189
关注
11
看过 TA
1920
男
中国第一拖拖拉机集团有限公司拖拉机学院
2022
C++
IP属地:江苏
all in AI
私信
关注
拉黑
举报
举报
确定要拉黑AIGC吗?
发布(90)
评论
刷题
收藏
AIGC
关注TA,不错过内容更新
关注
2021-10-13 18:55
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #加起来和为目标值的组合#
class Solution { public: vector<vector<int> > combinationSum2(vector<int> &num, int target) { vector<vector<int> > res; vector<int> tmp; //初始化 if (num.empty()) return res; //特殊情况处理 sort(num.begin(), num.end()...
0
点赞
评论
收藏
分享
2021-10-13 18:04
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #最长回文子串#
class Solution { public: void manacher(string s,int n,vector<int>& p){ int m = 0; int r = m + p[0]; //回文串的最右点 for(int i = 1; i < n; i++){ //当新中心在之前的回文中时 if(r > i) p[i] = p[2*m-i]<(r - i)?p[2*m-i]:(r-i); //...
0
点赞
评论
收藏
分享
2021-10-13 15:43
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #最长回文子串#
class Solution { public: int getLongestPalindrome(string A, int n) { // write code here if(n < 2)return A.size(); //处理特殊情况 int max = 0; for(int i = 0; i < n;){ if(n-i <= max / 2) break;//剩余数量不足最大值的一半时,直接终止 int l = i; ...
0
点赞
评论
收藏
分享
2021-10-13 15:21
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #最长回文子串#
class Solution { public: //时间n的平方,空间1的方法 bool isornot(string s){ string ss = s; reverse(s.begin(), s.end()); return s == ss; } int getLongestPalindrome(string A, int n) { // write code here int max = 0; for(int i = 0; i < n; i++...
0
点赞
评论
收藏
分享
2021-10-13 14:51
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #斐波那契数列#
class Solution { public: int Fibonacci(int n) { //动态规划 int n1 = 0, n2 = 1; while(--n){ n2 = n1 + n2; n1 = n2 - n1; } return n2; } };
0
点赞
评论
收藏
分享
2021-10-13 14:43
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #斐波那契数列#
class Solution { public: //递归 int Fibonacci(int n) { if(n == 1 || n ==2) return 1; return Fibonacci(n-1) + Fibonacci(n-2); } };
0
点赞
评论
收藏
分享
2021-10-13 14:32
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #两个链表生成相加链表#
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: /** * * @param head1 ListNode类 * @param head2 ListNode类 * @return ListNode类 */ ...
0
点赞
评论
收藏
分享
2021-10-13 13:44
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #最长公共子串#
class Solution { public: /** * longest common substring * @param str1 string字符串 the string * @param str2 string字符串 the string * @return string字符串 */ string LCS(string str1, string str2) { // write code here //初始化dp矩阵值为0 vector<vector<int...
0
点赞
评论
收藏
分享
2021-10-13 12:13
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #按之字形顺序打印二叉树#
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } }; */ class Solution { public: vector<vector<int> > Print(TreeNode* pRoot) { vector<vector<int>> res;...
0
点赞
评论
收藏
分享
2021-10-13 11:05
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #括号序列#
class Solution { public: /** * * @param s string字符串 * @return bool布尔型 */ bool isValid(string s) { // write code here stack<char> stack; for(auto cur:s){ if(stack.empty()){ stack.push(cur); }else{ ...
0
点赞
评论
收藏
分享
2021-10-13 10:53
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #最长无重复子数组#
class Solution { public: /** * * @param arr int整型vector the array * @return int整型 */ int maxLength(vector<int>& arr) { // write code here unordered_map<int,int> hash; int re = 0; for(int i =0 ,j = 0; i < arr.size(); i ++...
0
点赞
评论
收藏
分享
2021-10-13 10:38
中国第一拖拖拉机集团有限公司拖拉机学院 C++
题解 | #最长无重复子数组#
class Solution { public: /** * * @param arr int整型vector the array * @return int整型 */ int maxLength(vector<int>& arr) { // write code here if(arr.size()==0)return 0; if(arr.size()==1)return 1; int max = 0; int sum = 0; ...
0
点赞
评论
收藏
分享
2021-09-23 17:06
中国第一拖拖拉机集团有限公司拖拉机学院 C++
2021-09-23
在牛客打卡3天,今天学习:刷题 8 道/代码提交 53 次/学习课程 2 节
每日监督打卡
0
点赞
评论
收藏
分享
2021-09-11 14:18
中国第一拖拖拉机集团有限公司拖拉机学院 C++
万里长征第一步
2021-09-11
在牛客打卡2天,今天学习:刷题 5 道/代码提交 16 次
每日监督打卡
0
点赞
评论
收藏
分享
2021-01-13 17:31
中国第一拖拖拉机集团有限公司拖拉机学院 C++
2021-01-13
在牛客打卡1天,今天学习:刷题 6 道/代码提交 36 次
每日监督打卡
0
点赞
评论
收藏
分享
1
2
3
4
5
6
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客企业服务