Yosgi
Yosgi
Avatar
😀
3d ai agents ai engineering ai systems algorithms algorithms array binary search tree binary tree css design pattern digital twin digital twins engineering frontend investing investing javascript javascript leetcode life linked list mcp mongodb network node.js performance optimization product engineering projects queue react sorting stack string vue web development web performance
  • 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 …
    Algorithms Created Wed, 17 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Tue, 16 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Tue, 16 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Tue, 16 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Mon, 15 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Sat, 13 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Sat, 13 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Sat, 13 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Sat, 13 Mar 2021 00:00:00 +1300
  • 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. …
    Algorithms Created Sat, 13 Mar 2021 00:00:00 +1300