Symmetric Tree
LeetCode https://leetcode.cn/problems/symmetric-tree/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeN...
LeetCode https://leetcode.cn/problems/symmetric-tree/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeN...
LeetCode https://leetcode.cn/problems/invert-binary-tree/ Recursive /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode righ...
LeetCode https://leetcode.cn/problems/binary-tree-level-order-traversal/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode ...
LeetCode https://leetcode.cn/problems/maximum-depth-of-binary-tree/ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right...
LeetCode https://leetcode.cn/problems/binary-tree-inorder-traversal/ 10 == root / \ 5 15 / \ / \ 2 7 12 20 ...
LeetCode https://leetcode.cn/problems/first-unique-character-in-a-string/ class Solution { public int firstUniqChar(String s) { HashMap<Character, Integer> map = new HashMap<...
LeetCode https://leetcode.cn/problems/lru-cache/ 这是个啥玩意?? https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU 题目描述 请你设计并实现一个满足LRU (最近最少使用) 缓存 约束的数据结构。 实现 LRUCache 类: LRUCache(int c...
LeetCode https://leetcode.cn/problems/group-anagrams/ 字母异位词分组 class Solution { public List<List<String>> groupAnagrams(String[] strs) { Map<String, List<String&g...
Leetcode https://leetcode.cn/problems/two-sum/ class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer, Integer> hashtable = new HashMap<Integer, Integer>...
读了很有感触,贴文章到这里存档 走一步再走一步(2016人教版) 默顿·亨特 那是在费城,一个酷热的七月天——直到56年后的今天,我仍能感觉到那种酷热。和我在一起的五个男孩子已经厌倦了玩弹珠,以及用透镜在干树叶上烧洞等游戏,他们正在寻觅其他好玩的事。 一脸雀斑的小内德说到:“嗨!我有主意了。我们很久没去爬悬崖了。” “我们走吧!”有人附和着。然后他们出发了,他们气喘吁吁地一路小跑...