techferryman
techferryman
全部文章
分类
归档
标签
去牛客网
登录
/
注册
techferryman的博客
全部文章
(共89篇)
题解 | #数值的整数次方#
/* * 方式一:直接运算(注意负数转换正数之后运算) * step 1:先处理次方数为负数的情况,将底数化为分数解决。 * step 2:遍历次方数的次数,不断累乘底数。 * */ public double Power(double base, i...
2023-05-28
0
241
题解 | #二进制中1的个数#
public class Solution { public int NumberOf1(int n) { int res = 0; for (int i = 0; i < 32; i++) { if ((n & (1 <&...
2023-05-28
0
222
题解 | #矩形覆盖#
public class Solution { /*方式一:递归*/ public int rectCover(int target) { if(target == 0) return 0; if(target == 1) return 1; ...
2023-05-28
0
245
题解 | #跳台阶扩展问题#
public class Solution { public int jumpFloorII(int target) { if (target <= 0) return 0; int[] dp = new int[target + 1]; ...
2023-05-28
0
219
题解 | #用两个栈实现队列#
import java.util.Stack; public class Solution { Stack<Integer> stack1 = new Stack<Integer>(); Stack<Integer> stack2 = new S...
2023-05-28
0
192
题解 | #跳台阶#
public class Solution { public int jumpFloor(int target) { // 存储上一步的步数,target指的索引,索引+1是数组长度 int[] dp = new int[target + 1]; ...
2023-05-28
0
244
题解 | #找到搜索二叉树中两个错误的节点#
import java.util.*; /* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * } */ public class Sol...
2023-05-28
0
350
题解 | #斐波那契数列#
public class Solution { public int Fibonacci(int n) { if (n == 0) return 0; if (n == 1) return 1; int[] dp = new int[n + 1...
2023-05-28
0
223
题解 | #旋转数组的最小数字#
import java.util.ArrayList; public class Solution { public int minNumberInRotateArray(int [] array) { if (array == null || array.length ==...
2023-05-27
0
284
题解 | #重建二叉树#
import java.util.*; /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * T...
2023-05-27
0
274
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页