三级缓存解决了循环依赖问题?别被骗了,一级缓存就够了!-牛翰网

三级缓存解决了循环依赖问题?别被骗了,一级缓存就够了!

方案导入 循环依赖是什么 构造出两个对象A和B,A中有成员B,B中有成员A,换成代码就是这样子。 @Component public class A { @Autowired private B b; } @Component public class B { @Autowire...
LeetCode周简报1-牛翰网

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...
天天用lock,不好奇他到底怎么工作的吗 —从ReentrantLock 到AQS-牛翰网

天天用lock,不好奇他到底怎么工作的吗 —从ReentrantLock 到AQS

新手学习,若有不对,欢迎大佬 调教🥰🥰🥰 ReentrantLock 我们经常用的 *ReentrantLock*是干什么的呢 我认为这是一个前台/门面(类似设计模式中的门面模式)根据我们的入参创建一个FairSync OR ...
以接口肢解bean factory,源码没那么神秘-牛翰网

以接口肢解bean factory,源码没那么神秘

本来昨天在看 spring frame的八股, 看到了IOC部分,但是实在看不懂是什么东西,讲是讲源码部分,但又不完全讲,我想着那我要不自己看一下源码 这是我画的Bean Factory的大致关系图 删去了bean...
hot100之技巧组题目-牛翰网

hot100之技巧组题目

只出现一次的数字(136) class Solution { public int singleNumber(int[] nums) { int res = 0; for (int num : nums){ res ^= num; } return res; } } 分析 异或 多数元素(169) class Soluti...
hot100之多维动态规划-牛翰网

hot100之多维动态规划

我是比较爱用自底向上的自底向上方法不会计算多余情况, 也不用memo存储 不同路径(062) class Solution { public int uniquePaths(int m, int n) { int[][] dp = new int[m][n]; for (int i =...
hot100之动态规划下-牛翰网

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之动态规划上-牛翰网

hot100之动态规划上

爬楼梯(070) class Solution { int[] memo = new int[50]; public int climbStairs(int n) { if (memo[n] != 0) return memo[n]; if (n == 0 || n ==1 ){ return 1; } if (n == 2){ return 2; }...
BIO, NIO, AIO 大白话 - 澄澈大学生也能搞懂-牛翰网

BIO, NIO, AIO 大白话 – 澄澈大学生也能搞懂

最近天天吃沙县, 就拿沙县分析 BIO Block I/O 沙县分析 相近时间来了4个顾客 顾客 菜品 时间 A 筒骨饭 5min B 茄子肉丝盖饭 7min C 猪脚饭 3min D 茄子肉丝盖饭 7min 老板只能按照顺序 5+7+3+7 ...
hot100之贪心-牛翰网

hot100之贪心

买卖股票的最佳时期(121) class Solution { public int maxProfit(int[] prices) { int res = 0; int min = Integer.MAX_VALUE; for (int i = 0; i < prices.length; i++){ min = Math.min(m...