04 2022 档案

摘要:leetcode 每日一题 427. 建立四叉树 class Solution { public Node construct(int[][] grid) {​ return f(grid, 0, 0, grid.length);​ }​ private Node f(int[][] grid, i 阅读全文
posted @ 2022-04-29 11:17 java架构师1 阅读(22) 评论(0) 推荐(0) 编辑
摘要:leetcode 每日一题 905. 按奇偶排序数组 class Solution { public int[] sortArrayByParity(int[] nums) { int i = 0; int j = nums.length - 1; while (i < j) { while (nu 阅读全文
posted @ 2022-04-28 09:30 java架构师1 阅读(12) 评论(0) 推荐(0) 编辑
摘要:1.第一步,修改redis配置文件内容 notify-keyspace-events "Ex" 2.项目导入redis依赖 <!-- Redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spri 阅读全文
posted @ 2022-04-27 15:22 java架构师1 阅读(862) 评论(0) 推荐(0) 编辑
摘要:SQL12 获取每个部门中当前员工薪水最高的相关信息 有一个员工表dept_emp简况如下: emp_no dept_no from_date to_date 10001 d001 1986-06-26 9999-01-01 10002 d001 1996-08-03 9999-01-01 1000 阅读全文
posted @ 2022-04-27 15:05 java架构师1 阅读(67) 评论(0) 推荐(0) 编辑
摘要:隐藏 Thread.sleep 无聊随便写写不做任何用途 实现原理: 1.反射调用Thread.sleep方法 2.把 Class.forName("java.lang.Thread ") 中的字符串 java.lang.Thread 换成ascii码 3.使用int数组来装,同时把ascii码转 阅读全文
posted @ 2022-04-27 09:49 java架构师1 阅读(30) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 883. 三维形体投影面积 class Solution { public int projectionArea(int[][] grid) { int sum = 0; for (int i = 0; i < grid.length; i++) { int max = 0 阅读全文
posted @ 2022-04-26 10:39 java架构师1 阅读(23) 评论(0) 推荐(0) 编辑
摘要:相同概率获取元素O(n) public static void main(String[] args) { //随机获取元素为3的下标 int target = 3; Random random = new Random(); int[] arr = {1, 2, 3, 3, 3, 4, 5}; i 阅读全文
posted @ 2022-04-25 13:54 java架构师1 阅读(44) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 398. 随机数索引 class Solution {​ private int[] nums;​ public Solution(int[] nums) { this.nums = nums; } public int pick(int target) { List<In 阅读全文
posted @ 2022-04-25 11:03 java架构师1 阅读(17) 评论(0) 推荐(0) 编辑
摘要:find_in_set 查询 随便弄了个表,演示查询效果 阅读全文
posted @ 2022-04-25 09:43 java架构师1 阅读(39) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 868. 二进制间距 class Solution { public int binaryGap(int n) { char[] arr = Integer.toBinaryString(n).toCharArray(); int[] res = new int[arr.l 阅读全文
posted @ 2022-04-24 08:51 java架构师1 阅读(17) 评论(0) 推荐(0) 编辑
摘要: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 阅读(24) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 388. 文件的最长绝对路径 1.先考虑各种情况,然后写公共情况,代码没优化,leetcode跑和本地测试结果不一样,没去往下做了 class Solution { public int lengthLongestPath(String input) { //不是目录的情况 阅读全文
posted @ 2022-04-20 20:07 java架构师1 阅读(16) 评论(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 阅读(443) 评论(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 阅读(122) 评论(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 阅读(31) 评论(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 阅读(648) 评论(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 阅读(9) 评论(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 阅读(170) 评论(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 阅读(18) 评论(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 阅读(34) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 380. O(1) 时间插入、删除和获取随机元素 class RandomizedSet {​ private Map<Integer,Integer> map; private List<Integer> list;​ public RandomizedSet() { m 阅读全文
posted @ 2022-04-13 10:07 java架构师1 阅读(28) 评论(0) 推荐(0) 编辑
摘要:MVCC多版本并发控制 MVCC是在并发访问数据库时,通过对数据做多版本管理,避免因为写锁的阻塞而造成读数据的并发阻塞问题。 1,和version思想差不多,innoDB下,开启一个事务,mysql的表对应有3个隐藏列 DB_TRX_ID: 记录操作该数据事务的事务ID; DB_ROLL_PTR:指 阅读全文
posted @ 2022-04-12 19:34 java架构师1 阅读(38) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 806. 写字符串需要的行数 class Solution { public int[] numberOfLines(int[] widths, String s) { int[] result = new int[2]; result[0] = 1; char[] arr 阅读全文
posted @ 2022-04-12 10:09 java架构师1 阅读(21) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 357.统计各位数字都不同 方法1:暴力破解,遍历每一种可能 class Solution {​ public int countNumbersWithUniqueDigits(int n) { boolean[] buf = new boolean[10]; return 阅读全文
posted @ 2022-04-11 09:55 java架构师1 阅读(20) 评论(0) 推荐(0) 编辑
摘要:leetcode每日一题 429.N 叉树的层序遍历 简单的DFS遍历 class Solution { public List<List<Integer>> levelOrder(Node root) { if(root == null){ return new ArrayList<>(); } 阅读全文
posted @ 2022-04-08 15:26 java架构师1 阅读(10) 评论(0) 推荐(0) 编辑
摘要:阿里云OSS图片大小修改 问题: 因为对接高空抛物摄像头,边缘分析主机,分页查询时各种告警图片需要展示到列表中,可是图片过于高清,加载较慢,设置压缩图片来列表展示,管理员点击图片后放大显示原图。 解决方案: 在oss图片地址后面拼接可直接压缩图片,不需要引入别的压缩图片工具,减少开发量 public 阅读全文
posted @ 2022-04-08 15:17 java架构师1 阅读(631) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示