上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 35 下一页
摘要: 给定二叉树的前序遍历,遍历是否是 BST public static boolean isValid(int[] arr, int start, int end, int min, int max){ if (start > end){ // start > end:当前子树为空,返回 true,因 阅读全文
posted @ 2023-10-23 10:58 爱新觉罗LQ 阅读(17) 评论(0) 推荐(0)
摘要: 判断一个数是质数 public class PrimeNumberChecker { public static boolean isPrime(int number) { if (number <= 1) { return false; // 1和负数不是质数 } if (number <= 3) 阅读全文
posted @ 2023-10-20 16:48 爱新觉罗LQ 阅读(15) 评论(0) 推荐(0)
摘要: 互质数判断【空杯心态】 1 和任何其它都是互质数 相邻2个一定互质 2个不同的质数一定互质 欧几里德算法 通过递归计算两个数的最大公约数(GCD) 如果最大公约数为1,则说明两个数互质。 public static int gcd(int a, int b){ if (a == 0){ return 阅读全文
posted @ 2023-10-20 13:27 爱新觉罗LQ 阅读(30) 评论(0) 推荐(0)
摘要: 利用 Stream 流将 TreeSet 转成数组 Integer[] arr = set.stream().toArray(Integer[]::new); 阅读全文
posted @ 2023-10-20 11:23 爱新觉罗LQ 阅读(62) 评论(0) 推荐(0)
摘要: 整型数组逆序 由于 int型数组没有实现 comparator 接口,所以不支持逆序排序,所以我们建数组的时候就建成 Integer型就好了 Scanner in = new Scanner(System.in); int target = Integer.parseInt(in.nextLine( 阅读全文
posted @ 2023-10-18 11:49 爱新觉罗LQ 阅读(17) 评论(0) 推荐(0)
摘要: List list 删除指定元素 List<Integer> list1 = new ArrayList<>(); list1.add(1); list1.add(2); list1.add(4); list1.add(3); list1.remove((Integer)4); System.out 阅读全文
posted @ 2023-10-17 23:34 爱新觉罗LQ 阅读(82) 评论(0) 推荐(0)
摘要: 无脑 检查是否存在满足条件的数字组合 import java.util.Scanner; import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(Str 阅读全文
posted @ 2023-10-17 20:06 爱新觉罗LQ 阅读(43) 评论(0) 推荐(0)
摘要: 贪心 1个维度【生活常识】 135. 分发糖果 class Solution { public boolean lemonadeChange(int[] bills) { int[] arr = new int[2]; for (int bill : bills) { if (bill == 5){ 阅读全文
posted @ 2023-10-17 12:55 爱新觉罗LQ 阅读(9) 评论(0) 推荐(0)
摘要: mybatis项目启动报错:reader entry: ���� = v https://blog.51cto.com/lianghecai/7702720 解决方式: <dependency> <groupId>org.jboss</groupId> <artifactId>jboss-vfs</ 阅读全文
posted @ 2023-10-16 16:10 爱新觉罗LQ 阅读(24) 评论(0) 推荐(0)
摘要: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation 解决方式 <dependency> <grou 阅读全文
posted @ 2023-10-16 16:08 爱新觉罗LQ 阅读(33) 评论(0) 推荐(0)
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 35 下一页