首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
课程
专栏·文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
Dolando
获赞
0
粉丝
0
关注
7
看过 TA
1
上海应用技术大学
2013
Java
IP属地:上海
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑Dolando吗?
发布(5)
刷题
Dolando
2021-12-03 00:28
Java
题解 | #连续子数组的最大和#
包含当前数的最大数设为f(i) f(i) =f(i-1)>0 ? f(i-1) : 0 + array[i] public class Solution { public int FindGreatestSumOfSubArray(int[] array) { int max = array[0];//总最大数 int nowMax = array[0];//包含当前数最大数 for(int i=1;i<array.length;i++){ nowMax = array[i] + Math.max(no...
0
点赞
评论
收藏
转发
Dolando
2021-12-01 23:33
Java
题解 | #最小的K个数#
堆排序实现: 容量不足:在最后插入元素+ 自下而上 容量满:对比是否小于堆顶元素:小于->替换堆顶元素+自上而下堆化 import java.util.ArrayList; public class Solution { public ArrayList<Integer> GetLeastNumbers_Solution(int[] input, int k) { ArrayList<Integer> list = new ArrayList(); if(k<=0){ return list;...
0
点赞
评论
收藏
转发
Dolando
2021-11-27 19:21
Java
题解 | #二分查找-II#
二分基础上 找到基础 往前迭代 import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * 如果目标值存在返回下标,否则返回 -1 * @param nums int整型一维数组 * @param target int整型 * @return int整型 */ public int search (int[] nums, int target) { // write c...
0
点赞
评论
收藏
转发
Dolando
2021-11-27 18:21
Java
题解 | #求二叉树的层序遍历#
迭代:使用队列存储当前层节点 开始遍历。 遍历前 保存上一层节点数nodeCount, 遍历完后 上一层处理完毕,队列中剩余的即下一层所有节点。 import java.util.*; /* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * } */ public class Solution { /** * * @param root TreeNode类 * @return int整型Arr...
0
点赞
评论
收藏
转发
Dolando
2021-11-26 00:14
Java
题解 | #设计LRU缓存结构#
get->o(1): map结构存key对应值 set->0(1): 双向链表存访问顺序。 1.访问到的已有节点:移除+尾插; 2.新节点:尾插,达到容量限制:头删。 import java.util.*; public class Solution { /** * lru design * @param operators int整型二维数组 the ops * @param k int整型 the k * @return int整型一维数组 */ public int[] LRU (int[][] opera...
0
点赞
评论
收藏
转发
1
工具箱
TA的圈子
暂未加入圈子
TA的圈子
TA的笔记
暂无笔记
TA的笔记
登录
0
天
已登录
0
天
连续登录
0
人
今日访客
牛客网
牛客企业服务