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: 30 minutes The idea is to first use the time complexity of On to count, and then solve it using the minimum heap method class Heap { constructor(list, compare = (a, b) => a - b) { this.left = …
    leetcode Created Thu, 08 Apr 2021 00:00:00 +0000
  • Time: 10 minutes const swap = function (arr,i,j) { [arr[i],arr[j]] = [arr[j],arr[i]] } class MaxHeap { constructor() { this.count = 0 this.data = new Array(this.count + 1) } shiftUp(k) { // Put the …
    leetcode Created Thu, 08 Apr 2021 00:00:00 +0000
  • Time: Read the answer Since it is a pile exercise, it must be closer to the idea of pile Since we only want the median, there is no need to sort all the numbers. You can use two heaps, a maximum heap …
    leetcode Created Wed, 24 Mar 2021 00:00:00 +0000
  • Time: Refer to the answer After reading the title, the first thing that comes to mind is that dp cannot escape But writing the conversion equation requires some skill Observe that dp[1][1] = …
    leetcode Created Mon, 22 Mar 2021 00:00:00 +0000
  • Time: 10 minutes A simple question shouldn’t ask me to write the maximum heap by hand. const swap = function (arr,i,j) { [arr[i],arr[j]] = [arr[j],arr[i]] } class MaxHeap { constructor() { this.count …
    leetcode Created Sun, 21 Mar 2021 00:00:00 +0000
  • Time: 60 minutes I was misled by the depth of the question and thought that the calculation depth should be done from top to bottom. In fact, it can be done from bottom to top. If the left and right …
    leetcode Created Sun, 21 Mar 2021 00:00:00 +0000
  • Time: 10 minutes Solve by using the property of pre-order traversal of binary tree var minDiffInBST = function(root) { var min = Infinity var pre = null var dfs = function (root) { if (!root) return …
    leetcode Created Thu, 18 Mar 2021 00:00:00 +0000
  • Time: 10 minutes The preorder is calculated from top to bottom, there is nothing much to say Converting binary to decimal is quite difficult, so I just parseInt(path, 2) var sumRootToLeaf = …
    leetcode Created Wed, 17 Mar 2021 00:00:00 +0000
  • Post-order traversal approach to delete target-valued leaf nodes using a dummy root.
    leetcode Created Wed, 17 Mar 2021 00:00:00 +0000
  • Notes on counting good nodes in a binary tree using DFS with a running max.
    leetcode Created Wed, 17 Mar 2021 00:00:00 +0000