首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
writezen
中国社会科学院
2016届
安卓工程师
文艺中年
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(40)
反转链表
408
public class Solution { public static ListNode ReverseList(ListNode head) { if(head==null) return null; ListNode reversedHead=null; ListNode curr...
发表于 2015-04-17 14:21:40
链表中倒数第k个结点
2
public class Solution { public ListNode FindKthToTail(ListNode head,int k) { if(head==null||k==0) return null; ListNode first =head; ListNode sec...
发表于 2015-04-16 23:16:59
调整数组顺序使奇数位于偶数前面
4
public class Solution { public static void reOrderArray(int[] array) { if (array == null || array.length == 0) return; int tmp = 0; for (int i...
发表于 2015-04-15 19:38:06
二进制中1的个数
516
public class Solution { //从n的2进制形式的最右边开始判断是不是1 /* * 该解法如果输入时负数会陷入死循环, * 因为负数右移时,在最高位补得是1 * 二本题最终目的是求1的个数,那么会有无数个 * 1了。 */ ...
发表于 2015-04-13 15:56:52
斐波那契数列
23
public class Solution { public int Fibonacci(int n) { int target=0; if(n==0) return 0; if(n==1) return 1; int one=0; int two=1; for(int i=...
发表于 2015-04-12 22:21:47
旋转数组的最小数字
14
public class Solution { /* * 传进去旋转数组,注意旋转数组的特性: * 1.包含两个有序序列 * 2.最小数一定位于第二个序列的开头 * 3.前序列的值都>=后序列的值 * 定义把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 * ^...
发表于 2015-04-11 17:54:07
用两个栈实现队列
14
import java.util.Stack; public class Solution { Stack<Integer> stack1 = new Stack<Integer>(); Stack<Integer> stack2 = new S...
发表于 2015-04-11 10:41:38
重建二叉树
11
public class Solution{ //通过传进前序遍历,和中序遍历 重建二叉树(可以输出新建的二叉树的后序遍历) //递归方法重构树 public static TreeNode reConstructBinaryTree (int[] pre,int[] in ){ if(p...
发表于 2015-04-10 11:27:41
从尾到头打印链表
6
import java.util.ArrayList; import java.util.Stack; public class Solution { public ArrayList<Integer> printListFromTailToHead(ListNode listN...
发表于 2015-04-09 20:55:24
关闭linux系统(不重新启动)可使用命令。
1
B
发表于 2015-03-31 17:43:41
首页
上一页
1
2
3
4
下一页
末页
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题