首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
renhao426
中山大学
2017届
Java工程师
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(8)
数组中出现次数超过一半的数字
1
public class Solution { public int MoreThanHalfNum_Solution(int [] array) { //法二:用数组的特点 if(array==null || array.length<=0){ ...
发表于 2016-09-03 20:31:43
和为S的连续正数序列
42
import java.util.ArrayList; /* *初始化small=1,big=2; *small到big序列和小于sum,big++;大于sum,small++; *当small增加到(1+sum)/2是停止 */ public class Solution { public...
发表于 2016-08-11 15:56:44
数据流中的中位数
1
import java.util.PriorityQueue; import java.util.Comparator; public class Solution { //PriorityQueue 是最小堆排序,优先队列默认是自然排序,就是小的在前面 //实现Comparator接口,...
发表于 2016-08-06 17:42:46
数组中的逆序对
9
/* *归并排序的思想,最后求得的逆序数进行取摸 % 1000000007 */ public class Solution { public int InversePairs(int [] array) { if(array==null || array.length&l...
发表于 2016-07-28 19:53:04
最小的K个数
78
/* *基于堆排序算法,构建最大堆。时间复杂度为O(nlogk) *如果用快速排序,时间复杂度为O(nlogn); *如果用冒泡排序,时间复杂度为O(n*k) */ import java.util.ArrayList; public class Solution { public Arra...
发表于 2016-07-27 22:12:55
包含min函数的栈
1
public class Solution { Stack<Integer> stackData; Stack<Integer> stackMin; public Solution(){ stackData=new Stack<Inte...
发表于 2016-07-15 15:06:53
两个链表的第一个公共结点
0
public class Solution { public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) { if(pHead1==null||pHead2==null){ ...
发表于 2016-07-14 15:39:23
反转链表
0
public class Solution { public ListNode ReverseList(ListNode head) { if(head==null){ return null; } ...
发表于 2016-07-13 10:11:01
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题