上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页
摘要: ##子集 class Solution { List<List<Integer>> sum=new LinkedList<>(); LinkedList<Integer> path=new LinkedList<>(); public List<List<Integer>> subsets(int[ 阅读全文
posted @ 2022-02-06 21:50 一刹流云散 阅读(20) 评论(0) 推荐(0) 编辑
摘要: ##组合 class Solution { List<List<Integer>> sum=new LinkedList<>(); LinkedList<Integer> path=new LinkedList<>(); public List<List<Integer>> combine(int 阅读全文
posted @ 2022-02-05 11:54 一刹流云散 阅读(17) 评论(0) 推荐(0) 编辑
摘要: ##左叶子之和 class Solution { public int sumOfLeftLeaves(TreeNode root) { if(root==null) return 0; int result=0; if(root.left!=null&&root.left.left==null&& 阅读全文
posted @ 2022-02-04 09:00 一刹流云散 阅读(21) 评论(0) 推荐(0) 编辑
摘要: ##移除元素 class Solution { public int removeElement(int[] nums, int val) { int slow=0; int fast=0; for(fast=0;fast<nums.length;fast++) { if(nums[fast]!=v 阅读全文
posted @ 2022-02-03 12:04 一刹流云散 阅读(22) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2022.cnblogs.com/blog/2646563/202202/2646563-20220202214747245-1666824570.png) ![](https://img2022.cnblogs.com/blog/2646563/202202/2646563-20220202215055255-1253291245.png) 阅读全文
posted @ 2022-02-02 21:51 一刹流云散 阅读(57) 评论(0) 推荐(0) 编辑
摘要: ##有效的字母异位词 class Solution { public boolean isAnagram(String s, String t) { int[] record=new int[26]; for(char c:s.toCharArray()) { record[c-'a']++; } 阅读全文
posted @ 2022-02-02 20:56 一刹流云散 阅读(30) 评论(0) 推荐(0) 编辑
摘要: ##NC105 二分查找-I 请实现无重复数字的升序数组的二分查找 给定一个 元素升序的、无重复数字的整型数组 nums 和一个目标值 target ,写一个函数搜索 nums 中的 target,如果目标值存在返回下标(下标从 0 开始),否则返回 -1 数据范围:0≤len(nums)≤2×10 阅读全文
posted @ 2022-02-01 19:13 一刹流云散 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 公平锁,非公平锁 公平锁:不能插队,必须先来后到 FIFO 非公平锁:可以插队 可以允许短任务优先(默认) /** * Creates an instance of {@code ReentrantLock}. * This is equivalent to using {@code Reentra 阅读全文
posted @ 2022-01-19 16:11 一刹流云散 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 什么是CAS public class CASDemo { //CAS compareAndSet:比较并交换 public static void main(String[] args) { AtomicInteger atomicInteger=new AtomicInteger(2020); 阅读全文
posted @ 2022-01-19 13:48 一刹流云散 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 饿汉式 可能会浪费空间 //饿汉式单例模式 public class Hungry { //可能会浪费空间 private byte[] data1=new byte[1024]; private byte[] data2=new byte[1024]; private byte[] data3=n 阅读全文
posted @ 2022-01-18 23:08 一刹流云散 阅读(25) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页