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
  • The first thing that comes to mind is to find the distance r of all heaters that are the shortest distance from the house, and then return the largest r var findRadius = function(houses, heaters) { …
    Algorithms Created Thu, 10 Jun 2021 00:00:00 +1200
  • Time: 60 minutes The quickest way of thinking when getting the question is to enumerate all the speeds at which bananas can be eaten and find the minimum speed at which all bananas can be eaten. The …
    Algorithms Created Wed, 28 Apr 2021 00:00:00 +1200
  • Time: 15 minutes There is nothing much to say about conventional heap sort class Heap { constructor(list, compare = (a, b) => a - b) { this.left = index => 2 * index + 1 this.right = index => 2 * …
    Algorithms Created Sat, 10 Apr 2021 00:00:00 +1200
  • 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 = …
    Algorithms Created Thu, 08 Apr 2021 00:00:00 +1200
  • 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 …
    Algorithms Created Thu, 08 Apr 2021 00:00:00 +1200
  • 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 …
    Algorithms Created Wed, 24 Mar 2021 00:00:00 +1300
  • 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] = …
    Algorithms Created Mon, 22 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Sun, 21 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Sun, 21 Mar 2021 00:00:00 +1300
  • 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 …
    Algorithms Created Thu, 18 Mar 2021 00:00:00 +1300