摘要:
力扣题目链接 位运算 class Solution { public void reverseString(char[] s) { int l = 0; int r = s.length - 1; while(l<r){ s[l] ^= s[r];//s[l] = a^b s[r] ^= s[l]; 阅读全文
posted @ 2022-02-01 16:08
蹇爱黄
阅读(21)
评论(0)
推荐(0)
摘要:
力扣题目链接 双指针 class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> result = new ArrayList<>(); Arrays.sort(n 阅读全文
posted @ 2022-02-01 15:36
蹇爱黄
阅读(50)
评论(0)
推荐(0)
摘要:
1.HashSet class Solution { public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> millionYuanList = new ArrayList<>(); if(nums.length < 阅读全文
posted @ 2022-02-01 15:25
蹇爱黄
阅读(103)
评论(0)
推荐(0)
摘要:
与有效字母异位词类似 class Solution { public boolean canConstruct(String ransomNote, String magazine) { //记录杂志字符串出现的次数 int[] arr = new int[26]; int temp; char[] 阅读全文
posted @ 2022-02-01 14:37
蹇爱黄
阅读(45)
评论(0)
推荐(0)
摘要:
1.使用HashMap class Solution { public int fourSumCount(int[] nums1, int[] nums2, int[] nums3, int[] nums4) { //统计前两个数组中的元素之和(key),以及出现次数(valuevalue) Map 阅读全文
posted @ 2022-02-01 14:10
蹇爱黄
阅读(54)
评论(0)
推荐(0)
摘要:
#1.使用HashMap class Solution { public int[] twoSum(int[] nums, int target) { if(nums==null || nums.length==0){ return new int[0]; } //存储结果的数组 int[] res 阅读全文
posted @ 2022-02-01 13:31
蹇爱黄
阅读(68)
评论(0)
推荐(0)