摘要:
# HashSet ``` contains add ``` # Stack ``` empty peek pop push(add) size ``` # HashMap ``` map.keySet() valueOf(value) get(key), put(key, value), isEm 阅读全文
摘要:
# Bean生命周期步骤详情 * UserService -> 推断构造方法 -> 普通对象 -> 依赖注入(给对象赋值) -> 初始化前(@PostConstruct) -> 初始化(afterPropertiesSet()) -> 初始化后(AOP) -> 代理对象 ->Map : 单例池 Be 阅读全文
摘要:
https://blog.csdn.net/m0_45406092/article/details/118185561 阅读全文
摘要:
每日温度 链接 class Solution { public int[] dailyTemperatures(int[] temperatures) { int n = temperatures.length; int[] res = new int[n]; Deque<Integer> stac 阅读全文
摘要:
数组中第k个最大元素 链接 class Solution { public int findKthLargest(int[] nums, int k) { PriorityQueue<Integer> q = new PriorityQueue<Integer>(k, new Comparator< 阅读全文
摘要:
寻找重复数 寻找重复数 class Solution { public int findDuplicate(int[] nums) { int len = nums.length; int l = 1, r = len - 1; while (l < r) { int mid = (l + r) / 阅读全文
摘要:
# 共享内存(不使用锁) ``` class test { private static int count = 0; public static void main(String[] args) { Thread t1 = new MyThread(0); Thread t2 = new MyTh 阅读全文
摘要:
class LRUCache { int capacity; Map<Integer, Integer> map; public LRUCache(int capacity) { this.capacity = capacity; map = new LinkedHashMap<>(); } pub 阅读全文
摘要:
背包 背包01 01背包 代码块 int dp[1004][1004], v[1004], w[1004]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> v[i] >> w[i]; } for 阅读全文
摘要:
试除法判定质数 bool is_prime(int x) { if (x < 2) return false; for (int i = 2; i <= x / i; i ++ ) if (x % i == 0) return false; return true; } 试除法分解质因数 void 阅读全文