2021年3月16日

Leet_Code_42_接雨水

摘要: public int trap(int[] height) { int result = 0; int maxValue = -1; int maxAdder = 0; //取数组最大的下标和它的值 for (int i=0;i<height.length;i++) { if (height[i] 阅读全文

posted @ 2021-03-16 22:24 MaXianZhe 阅读(55) 评论(0) 推荐(0)

Leet_Code_137_唯一的数字

摘要: public int singleNumber(int[] nums) { int ans = 0; for (int i=0;i<32;i++) { int count = 0; for (int num : nums) { if (((num >>> i) &1) == 1) { count++ 阅读全文

posted @ 2021-03-16 22:20 MaXianZhe 阅读(68) 评论(0) 推荐(0)

Leet_Code_567_字符串排列

摘要: public static boolean checkInclusion(String s1, String s2) { int[] charArray1 = new int[26]; int[] charArray2 = new int[26]; for (char c : s1.toCharAr 阅读全文

posted @ 2021-03-16 19:09 MaXianZhe 阅读(57) 评论(0) 推荐(0)

LeetCode_424_替换后的最长字符串

摘要: class Solution { public int characterReplacement(String s, int k) { int left =0,right=0; int maxLength = -1; int result = 0; char[] charNums = new cha 阅读全文

posted @ 2021-03-16 18:39 MaXianZhe 阅读(40) 评论(0) 推荐(0)

LeetCode_139_单词拆分

摘要: class Solution { public boolean wordBreak(String s, List<String> wordDict) { return isContain(s, wordDict); } Map<String,Boolean> map = new HashMap<>( 阅读全文

posted @ 2021-03-16 18:38 MaXianZhe 阅读(54) 评论(0) 推荐(0)

导航