上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 35 下一页
摘要: import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型一维数组 * @return int整型 */ public int rob ( 阅读全文
posted @ 2022-12-07 10:52 northli 阅读(11) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int FindGreatestSumOfSubArray(int[] array) { int[] dp = new int[array.length]; int max = array[0]; dp[0] = array[0]; fo 阅读全文
posted @ 2022-12-06 10:48 northli 阅读(8) 评论(0) 推荐(0) 编辑
摘要: Arrays.copyOfRange(arr, from,to) 阅读全文
posted @ 2022-12-06 10:34 northli 阅读(12) 评论(0) 推荐(0) 编辑
摘要: Java的基本数据类型有8种,分别是:byte(位)、short(短整数)、int(整数)、long(长整数)、float(单精度)、double(双精度)、char(字符)和boolean(布尔值)。 数组是引用类型 int[] arr2 = {1,3,4,2}; Arrays.sort(arr2 阅读全文
posted @ 2022-12-05 10:07 northli 阅读(19) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Solution { /*** 解码 * @param nums string字符串 数字串 * @return int整型 */ public int solve (String nums) { if(nums==null ||nu 阅读全文
posted @ 2022-12-04 12:16 northli 阅读(7) 评论(0) 推荐(0) 编辑
摘要: reentrantlock和synchronized的区别是,可以指定两个或者多个队列,唤醒指定队列的线程 生产者消费者,一个锁对象有两个队列,一个是生产者队列,一个是消费者队列 阅读全文
posted @ 2022-12-03 16:08 northli 阅读(20) 评论(0) 推荐(0) 编辑
摘要: byte = 1字节 = 8bit 可表达 2的八次方个数字 short= 2字节 = 16bit 可表达2的十六次方个数字 int = 4字节 = 32bit 可表达2的32次方 不过用byte类型的时候,一般都是用数组的形式来存放字符的. 1. 英文和数字占一个字节; 可以用byte表示 2. 阅读全文
posted @ 2022-12-02 17:33 northli 阅读(96) 评论(0) 推荐(0) 编辑
摘要: new 一个子类对象,会先执行父类构造方法,再执行子类构造方法 构造方法中如果自己显性的调用super()的时候一定要放在第一行,如不是的话就会报错 参考:https://jingyan.baidu.com/article/fdffd1f8773e77b2e98ca1e1.html 阅读全文
posted @ 2022-12-02 17:24 northli 阅读(15) 评论(0) 推荐(0) 编辑
摘要: String的replace不会改变原来的String,会新增一个String String str = "abcdefg"; String re = str.replace("c","c2"); StringBuffer的replace会改变原来的StringBuffer,会替换起始位置到结束位置 阅读全文
posted @ 2022-12-02 11:42 northli 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 描述 给定两个字符串str1和str2,输出两个字符串的最长公共子串 题目保证str1和str2的最长公共子串存在且唯一。 数据范围: 1 \le |str1|,|str2| \le 50001≤∣str1∣,∣str2∣≤5000要求: 空间复杂度 O(n^2)O(n2),时间复杂度 O(n^2) 阅读全文
posted @ 2022-12-02 11:19 northli 阅读(19) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 35 下一页