鲜橙榨汁lisey
鲜橙榨汁lisey
全部文章
分类
题解(3)
归档
标签
去牛客网
登录
/
注册
鲜橙榨汁lisey的博客
全部文章
(共44篇)
题解 | #牛群中的编号是否有效#用层次遍历的方法做
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param root TreeNode类 * @return bool布尔型 *...
2024-04-07
1
196
题解 | #牛群排列去重#
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param head ListNode类 * @return ListNode类 ...
2024-04-05
0
154
#打家劫舍(二)#逐渐找到解题的乐趣了,100道还远吗?
public int rob (int[] nums) { // write code here if(nums.length==1) return nums[0]; int n=nums.length; // 最后一家不能偷 int[...
2024-04-03
0
214
题解 | #最长回文子串#提供一种很容易理解的代码
public int getLongestPalindrome (String A) { // write code here if(A.length()==1) return 1; int res=0; int l,r=0; ...
2024-04-03
0
199
题解 | #最长上升子序列(一)#
public int LIS (int[] arr) { // write code here if(arr.length==1) return 1; int[] dp=new int[arr.length]; Arrays.fill(...
2024-04-03
0
195
题解 | #把数字翻译成字符串#
public int solve (String nums) { // write code here int n=nums.length(); if(n==0||nums.charAt(0)=='0') return 0; if(n=...
2024-04-03
0
199
题解 | #表达式求值#代码容易懂,但是比较繁琐,写出不易
public int solve (String s) { // write code here Stack<Integer> nums=new Stack<>(); nums.push(0); Stack<...
2024-03-31
0
216
题解 | #质检员的烦恼#写了一天,还是时间复杂度太高,真的心累。求高手改!!!
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 计算质检员每轮应该如何选择正整数K,才能在运气最差的情况下用最短的时间找到不合格的手机?并输出该最短的时间。 # @param n int整型 手机个数N # @param a int整型 单个移动时间A # @p...
Java
2024-03-25
1
485
题解 | #用两个栈实现队列#第35道题,100道还远吗?
import java.util.*; import java.util.Stack; public class Solution { Stack<Integer> stack1 = new Stack<Integer>(); Stack<Intege...
2024-03-25
0
190
题解 | #判断平衡二叉树#从小白到30题,100道还很远吗
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param pRoot TreeNode类 * @return bool布尔型 ...
2024-03-24
0
213
首页
上一页
1
2
3
4
5
下一页
末页