hot100之动态规划下
最长递增子序列(300) class Solution { public int lengthOfLIS(int[] nums) { int res = 1; for(int num : nums){ int idx = findLarge(nums, res, num); nums[idx] = num; if (idx == res) ...
hot100之二叉树上
二叉树的中序队列(094) 先看代码 class Solution { public List<Integer> inorderTraversal(TreeNode root) { List<Integer> res = new ArrayList<>(); Stack<TreeNode>...
hot100之双指针
移动0(283) 先看代码 class Solution { public void moveZeroes(int[] nums) { int idx0 = 0; for (int idx = 0; idx < nums.length; idx++){ if(nums[idx] != 0){ int temp = nums[idx0]; n...
三级缓存解决了循环依赖问题?别被骗了,一级缓存就够了!
方案导入 循环依赖是什么 构造出两个对象A和B,A中有成员B,B中有成员A,换成代码就是这样子。 @Component public class A { @Autowired private B b; } @Component public class B { @Autowire...
为什么说一个中文占三个字节
缘由 在学习java基础时 对于s2,一个中文占用3个字节**,21845个正好占用65535个字节,而且字符串长度是21845,长度和存储也都没超过限制,所以可以编译通过 后来发现这句话是错的, java中char...
几分钟了解下java虚拟机–02
几分钟应该看不完,私密马赛, 俺是标题党 既然来了, 看看吧, 球球你了 Java类加载器 类的生命周期和加载过程 加载 加载所有的.class文件/jar文件/网络流 →字节流 (JVM 与java.lang.classLoader...
LeetCode周简报1
每日一题 Day1 最长和谐子序列(594) class Solution { public int findLHS(int[] nums) { Arrays.sort(nums); int lef = 0; int res = 0; for (int rig = 0; rig < nums.length; rig++){ whi...
几分钟了解下java虚拟机–01
JDK, JRE, JVM的关系 解释器: 逐行转换字节码为机器码 即时编译器(JIT):将热点代码(经常执行的代码段)编译成高效的本地机器码,并缓存起来以供后续直接执行 Just-In-Time Compiler 就范围来说...