首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
来个大厂offer吧
门头沟学院
2021届
Java工程师
关注
私信
加入黑名单
举报TA
TA的博客
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(32)
调整数组顺序使奇数位于偶数前面
1
public class Solution { public void reOrderArray(int [] array) { //利用插入思想 //遇到偶数什么也不做,遇到奇数向前插入 //插到已找到的奇数的后一位 for(...
发表于 2019-08-11 09:50:47
二进制中1的个数
1
public class Solution { public int NumberOf1(int n) { int count = 0; while(n != 0){ if((n & 1) == 1){ count+...
发表于 2019-08-10 21:06:21
数组中只出现一次的数字
1
//num1,num2分别为长度为1的数组。传出参数 //将num1[0],num2[0]设置为返回结果 public class Solution { public void FindNumsAppearOnce(int [] array,int num1[] , int num2[]) ...
发表于 2019-08-10 20:48:27
跳台阶
1
public class Solution { /* 对于第n个台阶来说,只能从n-1或者n-2的台阶跳上来,所以 F(n) = F(n-1) + F(n-2) 斐波拉契数序列,初始条件 n=1:只能一种方法 n=2:两...
发表于 2019-08-10 19:08:11
二叉树的深度
0
import java.util.*; public class Solution { public int TreeDepth(TreeNode root) { if(root == null){ return 0; } ...
发表于 2019-08-09 19:53:05
合并两个排序的链表
1
//四个大字,简洁明了 public class Solution { public ListNode Merge(ListNode list1,ListNode list2) { ListNode head = new ListNode(0); ListNo...
发表于 2019-08-09 15:09:43
判断是不是平衡二叉树
0
public class Solution { public boolean IsBalanced_Solution(TreeNode root) { return process(root) != -1; } //平衡返回高度 //不平衡返回-1 ...
发表于 2019-08-09 14:43:20
两个链表的第一个公共结点
1
//p1走到pHead1末尾定位到pHead2 //p2走到pHead2末尾定位到pHead1 //如果不相交,则在第二次走的时候同时走到末尾跳出循环 //如果相交,则在相交处跳出循环 public class Solution { public ListNode FindFirstComm...
发表于 2019-08-09 14:36:46
从上往下打印二叉树
1
import java.util.ArrayList; import java.util.Queue; import java.util.LinkedList; /** public class TreeNode { int val = 0; TreeNode left = null...
发表于 2019-08-09 10:29:31
从尾到头打印链表
1
public class Solution { public ArrayList<Integer> printListFromTailToHead(ListNode listNode) { ArrayList<Integer> list = new A...
发表于 2019-08-09 09:55:20
首页
上一页
1
2
3
4
下一页
末页
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题