Siqi Liu
Siqi Liu
Avatar
😀
ai blockchain database design patterns digitaltwin frontend frontend hook investment javascript javascript leetcode life node.js oop optimization react review project technology vue web
  • Time: 6 minutes It’s very simple. In-order traversal, calculate whether the value 1 exists in the subtrees on both sides, and remove it if not. If the left or right subtree or the tree itself contains …
    leetcode Created Wed, 17 Mar 2021 00:00:00 +0000
  • The question is about starting from the root node. The first thing that comes to mind is top-down DFS, passing parameters downward, and the end condition has no left or right children. Start with the …
    leetcode Created Tue, 16 Mar 2021 00:00:00 +0000
  • Time: 15 minutes Time: 15 minutes My first reaction when I got the question was to use recursion, but after I started writing it, I found that The condition that recursion needs to meet is that the …
    leetcode Created Tue, 16 Mar 2021 00:00:00 +0000
  • Time: 20 minutes Because we are looking for “the path starting from each node is sum” Obviously, backtracking comes to mind. Since it is a binary tree, double recursion is used. The outer recursion is …
    leetcode Created Tue, 16 Mar 2021 00:00:00 +0000
  • Time: 30 minutes Once you understand the question, you can actually do it quickly. The question is about the value of any node. We can find the value of each node and choose the largest one. Since the …
    leetcode Created Mon, 15 Mar 2021 00:00:00 +0000
  • Time: 80 minutes The first reaction when I got the question was of course to solve it with DFS. But this is a complete binary tree, so we should use the properties of a complete binary tree. You can …
    leetcode Created Sat, 13 Mar 2021 00:00:00 +0000
  • Time: 120 minutes The initial idea was to use BFS, and remove a whole queue when removing it (later I learned that this is called breadth traversal) Then the double pointer finds the left and right …
    leetcode Created Sat, 13 Mar 2021 00:00:00 +0000
  • Time: 60 minutes The idea is still very simple. First use DFS to add a parent to each node, and find the required target by the way. Then starting from the target, use DFS to find a point K away from …
    leetcode Created Sat, 13 Mar 2021 00:00:00 +0000
  • Time: 10 minutes Just use the increasing property of in-order traversal of the binary search tree In-order traversal to find the left child Does pre exist? If not, assign , find the right child, and …
    leetcode Created Sat, 13 Mar 2021 00:00:00 +0000
  • Time: 60 minutes The idea is still in-order traversal, using pre to cache the previous node. Because the in-order traversal is incremental, you must find the larger one first and then the smaller one. …
    leetcode Created Sat, 13 Mar 2021 00:00:00 +0000