摘要:
#1.java基础 个人学习笔记有错请指正 ##1.多态 父抽象类被子类继承,并且子类可以重写父类方法。 ##2.静态变量 静态变量指的是被static修饰的类的变量;静态变量被所有类实例对象所共享,在内存中只有一个副本,当且仅当在类初次加载时会被初始化。 ##3.try catch finally 阅读全文
posted @ 2022-02-01 21:15
蹇爱黄
阅读(70)
评论(0)
推荐(0)
摘要:
力扣题目链接 基础知识 #1.解法一 class Solution { public String reverseStr(String s, int k) { StringBuffer res = new StringBuffer(); int length = s.length(); int st 阅读全文
posted @ 2022-02-01 17:15
蹇爱黄
阅读(34)
评论(0)
推荐(0)
摘要:
力扣题目链接 位运算 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
蹇爱黄
阅读(55)
评论(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
蹇爱黄
阅读(106)
评论(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
蹇爱黄
阅读(48)
评论(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
蹇爱黄
阅读(57)
评论(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
蹇爱黄
阅读(70)
评论(0)
推荐(0)