首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
课程
专栏·文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
Richael_lee
获赞
0
粉丝
0
关注
4
看过 TA
0
女
广西大学
2021
Java
IP属地:未知
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑Richael_lee吗?
发布(4)
刷题
Richael_lee
2020-08-13 17:36
已编辑
Java
【剑指offer】-29-最小的k个数
1. 异常值分析,再Arrays.sort数组排序后输出前k个 import java.util.ArrayList; import java.util.Arrays; public class Solution { public ArrayList<Integer> GetLeastNumbers_Solution(int [] input, int k) { ArrayList<Integer> list= new ArrayList<>(); if(k>input.length || input.le...
0
点赞
评论
收藏
转发
Richael_lee
2020-08-06 17:39
已编辑
Java
【剑指offer】-2-替换空格
1. 用Java自带的函数str.toString().replace(" ","%20") public class Solution { public String replaceSpace(StringBuffer str) { return str.toString().replace(" ", "%20"); } }2. 开辟一个新的字符串 当遇到 " ",就追加 "%20",否则遇到什么追加(append)什么 import java.util.*; public class Solution { public String replaceS...
0
点赞
评论
收藏
转发
Richael_lee
2020-08-06 20:19
已编辑
Java
【剑指offer】-28-数组中出现次数超过一半的数字
方法一:Map法。时间复杂度:O(n),空间复杂度:O(n)。 import java.util.*; public class Solution{ public int MoreThanHalfNum_Solution(int[] array) { if (array.length == 0 || array == null) return 0; Map<Integer, Integer> map = new HashMap<>(); int maxCount = 0; int val = 0; ...
0
点赞
评论
收藏
转发
Richael_lee
2020-08-06 20:21
已编辑
Java
【剑指offer】-30-连续子数组的最大和
典型的动态规划问题 状态定义:dp[i]表示以i结尾的连续子数组的最大和。状态转移方程:dp[i] = max(array[i], dp[i-1]+array[i]) 代码一: 以下代码用变量dpMax 存储dp[i]: public class Solution { public int FindGreatestSumOfSubArray(int[] array) { int max = array[0]; int dpMax = array[0]; for (int i = 1; i < array.length; i++) {...
0
点赞
评论
收藏
转发
1
工具箱
TA的圈子
暂未加入圈子
TA的圈子
TA的笔记
暂无笔记
TA的笔记
登录
0
天
已登录
0
天
连续登录
0
人
今日访客
牛客网
牛客企业服务