摘要:
//三个数的最大乘积 /* * 整型数组nums,在数组中找出由三个数字组成的最大乘积,并输出这个乘积。默认不会越界 * */ public class P9 { public static void main(String[] args) { // System.out.println(sort( 阅读全文
posted @ 2022-04-11 11:19
YonchanLew
阅读(30)
评论(0)
推荐(0)
摘要:
//x的平方根 /* * 在不使用sqrt(x)的情况下,得到x的平方根的整数部分 * */ public class P8 { public static void main(String[] args) { System.out.println(newton(12)); } //牛顿迭代 /* 阅读全文
posted @ 2022-04-11 11:19
YonchanLew
阅读(48)
评论(0)
推荐(0)
摘要:
//x的平方根 /* * 在不使用sqrt(x)的情况下,得到x的平方根的整数部分 * */ public class P7 { public static void main(String[] args) { System.out.println(binartSearch(26)); } //二分 阅读全文
posted @ 2022-04-11 11:18
YonchanLew
阅读(36)
评论(0)
推荐(0)
摘要:
//删除排序数组中的重复项 /* * 一个有序数组nums,原地删除重复出现的元素,使每个元素只出现一次,返回删除后数组的新长度 * 不能使用额外的数组空间,必须在原地修改输入数组并在使用O(1)额外空间的条件下完成 * */ public class P5 { public static void 阅读全文
posted @ 2022-04-11 11:17
YonchanLew
阅读(34)
评论(0)
推荐(0)
摘要:
//寻找数组的中心下标 /* * 给定一个整数数组nums,返回数组中心下标 * 中心:其左侧所有元素相加的和等于右侧所有元素相加的和 * 如果不存在,返回-1,如果有多个,返回最左边的一个 * */ public class P6 { public static void main(String[ 阅读全文
posted @ 2022-04-11 11:17
YonchanLew
阅读(38)
评论(0)
推荐(0)
摘要:
//统计素数个数 //素数:只能被1和自身整除的自然数,0、1除外 public class P4 { public static void main(String[] args) { System.out.println(eratosthenes(100)); } //非素数(合数) 12 = 2 阅读全文
posted @ 2022-04-11 11:16
YonchanLew
阅读(42)
评论(0)
推荐(0)
摘要:
tomcat日志乱码网上的基本套路是修改tomcat下的conf/logging.properties,把UTF-8全部替换为GBK,这个是必然可以解决的,但我们希望统一UTF8,不动配置文件的时候,通过修改VM options也能解决,修改后记得重启一下idea。 注意,我并没有学网上说的修改to 阅读全文
posted @ 2022-04-11 11:13
YonchanLew
阅读(149)
评论(0)
推荐(0)
摘要:
(1)先来一个小案例作为切入点 /* 这里记为代码一 */ @RestController public class IndexController { @Autowired private Redisson redisson; @Autowired private StringRedisTempl 阅读全文
posted @ 2022-04-11 11:04
YonchanLew
阅读(137)
评论(0)
推荐(0)
摘要:
//统计素数个数 //素数:只能被1和自身整除的自然数,0、1除外 public class P3 { public static void main(String[] args) { System.out.println(bf(100)); } //暴力算法 public static int b 阅读全文
posted @ 2022-04-11 10:34
YonchanLew
阅读(74)
评论(0)
推荐(0)
摘要:
//反转链表 public class ReverseList { static class ListNode{ int val; ListNode next; public ListNode(int val, ListNode next){ this.val = val; this.next = 阅读全文
posted @ 2022-04-11 10:33
YonchanLew
阅读(26)
评论(0)
推荐(0)

浙公网安备 33010602011771号