摘要: import java.util.ArrayList;import java.util.Arrays;import java.util.List;/** * 给定一个包含 n 个整数的数组 nums 和一个目标值 target, * 判断 nums 中是否存在四个元素 a,b,c 和 d , * 使 阅读全文
posted @ 2020-08-11 15:10 文所未闻 阅读(173) 评论(0) 推荐(0) 编辑
摘要: import java.util.ArrayList;import java.util.Arrays;import java.util.List;/** * * 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c , * 使得 a + b + c = 0 ?请你 阅读全文
posted @ 2020-08-11 15:05 文所未闻 阅读(190) 评论(0) 推荐(0) 编辑
摘要: public class TwoSum1 { /** * 暴力求解的方式 * @param nums * @param target * @return */ public int[] twoSum3(int[] nums, int target){ for(int i = 0; i < nums. 阅读全文
posted @ 2020-08-11 15:02 文所未闻 阅读(213) 评论(0) 推荐(0) 编辑
摘要: /** * 滑动窗口 * @param s * @return */public int lengthOfLongestSubString(String s){ //定义左右边界 int l = 0, r = -1; //[l...r] 此为滑动窗口,初始为空 int res = Integer.M 阅读全文
posted @ 2020-08-05 15:32 文所未闻 阅读(166) 评论(0) 推荐(0) 编辑
摘要: public void sortColors(int[] nums){ int zero = -1; int two = nums.length; for(int i = 0; i < two; ){ if(nums[i] == 1){ i ++; }else if(nums[i] == 2){ t 阅读全文
posted @ 2020-07-29 17:48 文所未闻 阅读(157) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/weixin_33841503/article/details/92396636 阅读全文
posted @ 2020-07-26 20:47 文所未闻 阅读(881) 评论(0) 推荐(0) 编辑
摘要: 使用jdk中的lock和condition机制实现生产者和消费者 import java.util.concurrent.locks.Condition;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks. 阅读全文
posted @ 2020-07-22 17:47 文所未闻 阅读(155) 评论(0) 推荐(0) 编辑
摘要: import org.aspectj.lang.JoinPoint;import org.aspectj.lang.annotation.AfterReturning;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang. 阅读全文
posted @ 2020-07-20 16:22 文所未闻 阅读(762) 评论(0) 推荐(0) 编辑
摘要: /** * 双指针的简单思路解法 * @param s * @return */public String reverserString1(String s){ //将字符串 s 变成 字符数组 char[] c = s.toCharArray(); //定义左右指针 int left = 0; i 阅读全文
posted @ 2020-07-12 16:22 文所未闻 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 以下方法方法三 https://blog.csdn.net/u011334954/article/details/103380227 阅读全文
posted @ 2020-07-11 19:08 文所未闻 阅读(180) 评论(0) 推荐(0) 编辑