上一页 1 ··· 6 7 8 9 10 11 12 下一页
摘要: leetcode每日一题 396. 旋转函数 1.暴力破解 超时 class Solution { public int maxRotateFunction(int[] nums) { if(nums.length == 1){ return 0; } int max = Integer.MIN_V 阅读全文
posted @ 2022-04-22 09:56 java架构师1 阅读(37) 评论(0) 推荐(0)
摘要: leetcode每日一题 388. 文件的最长绝对路径 1.先考虑各种情况,然后写公共情况,代码没优化,leetcode跑和本地测试结果不一样,没去往下做了 class Solution { public int lengthLongestPath(String input) { //不是目录的情况 阅读全文
posted @ 2022-04-20 20:07 java架构师1 阅读(26) 评论(0) 推荐(0)
摘要: 并发处理多任务(CompletableFuture) 1.开启多线程处理多任务并返回结果 public class Demo1 {​ private static LongAdder longAdder = new LongAdder();​ public static void main(Stri 阅读全文
posted @ 2022-04-20 14:48 java架构师1 阅读(457) 评论(0) 推荐(0)
摘要: key 定义在注解上,支持SPEL表达式 1.核心方法 /** * 获取缓存的key * key 定义在注解上,支持SPEL表达式 * * @author * @date * @param key * @param method * @param args * @return Object */ p 阅读全文
posted @ 2022-04-19 11:39 java架构师1 阅读(131) 评论(0) 推荐(0)
摘要: leetcode每日一题 821. 字符的最短距离 1.普通双指针 class Solution { public int[] shortestToChar(String s, char c) { int[] result = new int[s.length()]; int l = 0; int 阅读全文
posted @ 2022-04-19 10:00 java架构师1 阅读(39) 评论(0) 推荐(0)
摘要: 语法:insert into t_user_1 values(11,'王五',13),(9,'王五1111',13),(5,'王五111',13),(6,'王五1111',23) ON DUPLICATE KEY UPDATE name = VALUES(name) ,age = VALUES(ag 阅读全文
posted @ 2022-04-18 20:19 java架构师1 阅读(686) 评论(0) 推荐(0)
摘要: leetcode每日一题 386. 字典序排数 public List<Integer> lexicalOrder(int n) { List<Integer> list = new ArrayList<>(n); for (int i = 1; i < 10; i++) { f(list, n, 阅读全文
posted @ 2022-04-18 09:08 java架构师1 阅读(17) 评论(0) 推荐(0)
摘要: HashMap 优化% 使用&运算 来实现取模 1.前提条件 值必须是2的幂次方,看java1.8 hashMap源码 final V putVal(int hash, K key, V value, boolean onlyIfAbsent, boolean evict) { Node<K,V>[ 阅读全文
posted @ 2022-04-15 11:58 java架构师1 阅读(184) 评论(0) 推荐(0)
摘要: leetcode每日一题 1672. 最富有客户的资产总量 本地测试没问题,提交返回结果和本地测试不一致 class Solution { public NestedInteger deserialize(String s) { if(s.charAt(0) != '['){ return new 阅读全文
posted @ 2022-04-15 11:14 java架构师1 阅读(30) 评论(0) 推荐(0)
摘要: leetcode每日一题 1672. 最富有客户的资产总量 java8 解决 流比for循环慢,所以性能较低,int转Integer也存在性能损耗 class Solution { public int maximumWealth(int[][] accounts) { int[] max = ne 阅读全文
posted @ 2022-04-14 09:57 java架构师1 阅读(42) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 下一页