首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
搁浅的鱼儿
北京工业大学
2019届
Java工程师
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(36)
写一段程序,找出数组中第k大小的数,输出数所在的位置。
4
#include <iostream> #include <vector> using namespace std; int Partition(vector<int>&vec,int begin,int end) { int pivot=vec[b...
发表于 2016-08-28 10:41:09
有趣的数字
0
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #define INT_MAX_VAL 65535 using namespace std; ...
发表于 2016-08-25 20:48:06
两个链表的第一个公共结点
1
/*蛮力法 struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public: ListNode* Fi...
发表于 2016-08-07 21:38:02
第一个只出现一次的字符
1
class Solution { public: int FirstNotRepeatingChar(string str) { int len=str.size(); if(len<1||len>10000) return...
发表于 2016-08-07 10:42:35
丑数
0
class Solution { public: int GetUglyNumber_Solution(int index) { if(index<=0) return 0; vector<int> res...
发表于 2016-08-07 10:08:52
数组中出现次数超过一半的数字
1
1、先排序再找到数组中出现次数超过一半的数字 时间复杂度O(nlogn) 2、根据数组特点设计 时间复杂度O(n) 3、基于Partition函数 时间复杂度O(n) ...
发表于 2016-07-28 12:29:35
最小的K个数
209
1、全排序 时间复杂度O(nlogn) *通过牛客* class Solution { public: vector<int> GetLeastNumbers_Solution(vector<int> input, int k) { ...
发表于 2016-07-28 00:05:23
字符串的排列
1
仔细看了看,发现牛客中给的答案基本都是错误的,有些测试用例在牛客中可以过去,但是在IDE中无法过去,比如:abbc 方法一: class Solution { public: void Change(vector<string>& ar...
发表于 2016-07-26 10:09:26
复杂链表的复制
279
1、递归法 /* struct RandomListNode { int label; struct RandomListNode *next, *random; RandomListNode(int x) : label(x), n...
发表于 2016-07-23 17:45:11
二叉树中和为某一值的路径(二)
0
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class ...
发表于 2016-07-23 11:14:53
首页
上一页
1
2
3
4
下一页
末页
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题