摘要:
https://leetcode-cn.com/problems/reverse-words-in-a-string/ 思路:删除多余的空格,修好一个方法,给一定范围,翻转一定范围的字符串 public static String reverseWords(String s) { if (s == 阅读全文
posted @ 2021-06-27 17:16
syh-918
阅读(47)
评论(0)
推荐(0)
摘要:
https://leetcode-cn.com/problems/valid-anagram/ 思路1 统计字符数哈希表 思路2 使用数组记录出现次数 public boolean isAnagram(String s, String t) { if (s == null || t == null) 阅读全文
posted @ 2021-06-27 17:04
syh-918
阅读(65)
评论(0)
推荐(0)
摘要:
https://leetcode-cn.com/problems/subtree-of-another-tree/ public boolean isSubtree(TreeNode s, TreeNode t) { if (s == null || t == null) return false; 阅读全文
posted @ 2021-06-27 16:44
syh-918
阅读(57)
评论(0)
推荐(0)
摘要:
https://leetcode-cn.com/problems/flipped-string-lcci/ 思路1: 将目标字符串 s1,拼接上自己,判断给的字符串是否是当前拼接字符串的子串; public static boolean isRevolving(String s1, String s 阅读全文
posted @ 2021-06-27 16:38
syh-918
阅读(38)
评论(0)
推荐(0)
摘要:
https://leetcode-cn.com/problems/daily-temperatures/ 思路1: 使用单调递减栈 public int[] dailyTemperatures(int[] T) { if (T == null || T.length == 0) return nul 阅读全文
posted @ 2021-06-27 15:02
syh-918
阅读(47)
评论(0)
推荐(0)
摘要:
https://leetcode-cn.com/problems/maximum-binary-tree/ 思路1:用递归的思想来解决问题 思路2: 利用栈来解决,找出左边第一个比较大值,和右边第一个比较大值,两两比较取大的一个 public TreeNode constructMaximumBin 阅读全文
posted @ 2021-06-27 14:55
syh-918
阅读(46)
评论(0)
推荐(0)
浙公网安备 33010602011771号