LeetCode- Replace Words Solution

In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word successor. For example…

2021-01-12 · 4 分钟

LeetCode- Map Sum Pairs Solution

LeetCode- Map Sum Pairs Solution - Implement a MapSum class with insert, and sum methods

2020-09-22 · 2 分钟

LeetCode-Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. For example, given…

2020-07-28 · 2 分钟

LeetCode-Lowest Common Ancestor of a Binary Tree Solution

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common…

2020-07-28 · 1 分钟

LeetCode – Path Sum Solution

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A…

2020-07-12 · 1 分钟

LeetCode – Symmetric Tree Solution

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: But…

2020-07-12 · 1 分钟

LeetCode – Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.…

2020-06-23 · 1 分钟

LeetCode – Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.…

2020-06-23 · 1 分钟

LeetCode – Binary Tree Level Order Traversal Solution

Given a binary tree, return the _level order_ traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree [3,9,20…

2020-06-09 · 1 分钟

LeetCode –Binary Tree Postorder Traversal

Given a binary tree, return the _postorder_ traversal of its nodes' values. Example: Input:  [1,null,2,3] \\ / Output:  [3,2,1] Follow up: Recursive solution…

2020-06-04 · 1 分钟