01 2023 档案
摘要:2319. 判断矩阵是否是一个 X 矩阵 题解: 模拟 class Solution { public boolean checkXMatrix(int[][] grid) { int n = grid.length; for (int i = 0; i < n; i++) { for (int j
阅读全文
摘要:1669. 合并两个链表 題解: 模拟链表操作 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int
阅读全文
摘要:2315. 统计星号 题解: 按题意模拟 class Solution { public int countAsterisks(String s) { int n = s.length(); int res = 0; // 是否不在竖线对之间 boolean flag = true; for (in
阅读全文
摘要:1. Guava github google的开源本地缓存 堆内缓存 需要考虑GC问题 不用考虑序列化和反序列化问题 2. caffeine github Caffeine provides an in-memory cache using a Google Guava inspired API.
阅读全文
摘要:1. BlockingCache 2. FifoCache 3. LruCache 4. SoftCache 5. WeakCache 6. LoggingCache 7. ScheduledCache 8. SynchronizedCache 9. PerpetualCache 10. Seria
阅读全文
摘要:1824. 最少侧跳次数 题解 dp 数组: dp[i] 表示 到 第i条赛道的最小侧跳次数 class Solution { public int minSideJumps(int[] obstacles) { int INF = (int) 0x3f3f3f3f; int len = obsta
阅读全文
摘要:1817. 查找用户活跃分钟数 题解 模拟: 用map存,map的key存用户id,value存该用户的操作的time列表(去重,可以用set) 统计res,遍历map,map的value为 该用户的操作时间list,用这个list的size 放到相应的res数组里(注意res的下标从1开始,所以要
阅读全文
摘要:官方文档:https://dev.mysql.com/doc/refman/5.7/en/ 书: 1.《高性能MySQL》 2.《MySQL是怎样运行的:从根儿上理解MySQL》 https://juejin.cn/book/6844733769996304392 https://relph1119
阅读全文
摘要:2287. 重排字符形成目标字符串 class Solution { public int rearrangeCharacters(String s, String target) { int[] cnt = new int[30]; for (char c : s.toCharArray()) {
阅读全文
摘要:脏写( Dirty Write ) 如果一个事务修改了另一个未提交事务修改过的数据,那就意味着发生了脏写 脏读( Dirty Read ) 如果一个事务读到了另一个未提交事务修改过的数据,那就意味着发生了脏读 不可重复读(Non-Repeatable Read) 如果一个事务只能读到另一个已经提交的
阅读全文
摘要:2283. 判断一个数的数字计数是否等于数位的值 class Solution { public boolean digitCount(String num) { int[] a = new int[10]; char[] chars = num.toCharArray(); int[] cnt =
阅读全文
摘要:2185. 统计包含给定前缀的字符串 class Solution { public int prefixCount(String[] words, String pref) { int res = 0; for (String word : words) { if (isEqual(word, p
阅读全文
摘要:1802. 有界数组中指定下标处的最大值 class Solution { public int maxValue(int n, int index, int maxSum) { int l = 1, r = (int) 1e9; while (l < r) { int mid = (l + r +
阅读全文
摘要:2042. 检查句子中的数字是否递增 class Solution { public boolean areNumbersAscending(String s) { char[] ch = s.toCharArray(); int pre = -1; for (int i = 0; i < ch.l
阅读全文
摘要:2351. 第一个出现两次的字母 class Solution { public char repeatedCharacter(String s) { char[] chars = s.toCharArray(); int[] f = new int[30]; for (int i = 0; i <
阅读全文