首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
drdr
西安电子科技大学
2018届
C++工程师
ievergreen
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(65)
检查是否为BST
1
class Checker { public: //中序遍历,维持一个目前遍历过的最大值curmax,后面再遍历到的节点都要比这个最大值大,并不断更新这个curmax bool checkBST(TreeNode* root) { int curmax = INT_M...
发表于 2017-08-22 15:52:11
输出单层结点
1
class TreeLevel { public: ListNode* getTreeLevel(TreeNode* root, int dep) { ListNode* head = new ListNode(0); //临时的头结点 ListNode* r...
发表于 2017-08-22 15:12:19
查找入职员工时间排名倒数第三的员工所有信息
3
SELECT * FROM employees WHERE hire_date = (SELECT DISTINCT hire_date FROM employees ORDER BY hire_date DESC ...
发表于 2017-08-21 20:35:55
高度最小的BST
1
class MinimalBST { public: int buildMinimalBST(vector<int> vals) { int h = 0; helper(vals, 0, vals.size()-1, 0, h); ...
发表于 2017-08-21 18:27:46
双栈排序
5
vector<int> twoStacksSort(vector<int> numbers) { vector<int> stack; while(!numbers.empty()){ int num = n...
发表于 2017-08-18 16:25:17
回文链表
6
//将链表的后半部分翻转,然后从开头和中间处分别遍历 bool isPalindrome(ListNode* pHead) { if(pHead == NULL || pHead->next == NULL) return true; //翻转后半部分链...
发表于 2017-08-18 15:29:08
链表分割
2
//空间也为O(1) class Partition { public: ListNode* partition(ListNode* pHead, int x) { // write code here if (pHead == NULL) return pHead; int cnt...
发表于 2017-08-17 17:39:56
访问单个节点的删除
2
bool removeNode(ListNode* pNode) { // write code here if(pNode==NULL || pNode->next == NULL) return false; ListNode* tmp = ...
发表于 2017-08-17 16:08:28
像素翻转
9
别人的思路: 首先上下翻转,再按照主对角线翻转 1 2 3 7 8 9 7 4 1 4 5 6 —> 4 5 6 ---> 8 5 2 7 8 9 ...
发表于 2017-08-15 17:32:24
空格替换
4
string replaceSpace(string iniString, int length) { int spaceCnt = 0; for(int i = 0; i < length; ++i) if(iniString[i] =...
发表于 2017-08-15 16:22:40
首页
上一页
1
2
3
4
5
6
7
下一页
末页
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题