• Python daily search position


    🌤(day31) catalogue Title: Topic analysis: Problem solving ideas: code implementation code annotation Title: Given a sort array and a target value, find the target value in the array and return its index. If the target value does not exist in the array, return the position where it will be inserted in order. You must use […]

  • Tips – white whoring deep document translation


    problem Although deep provides free document translation, there are translation restrictions on the number and size of words. There must be a charge for exceeding. The problem is that Chinese subscriptions are not supported for the time being. thinking As long as it is reduced to meet the requirements step Suppose I have a PDF […]

  • R use abestr to create an estimation diagram


    This section will share a small example of statistical analysis through RabestrLet’s draw the estimation chart, and all audience masters will savor it carefully Introduction to estimation chart:https://acclab.github.io/robust-statistical-visualization.html Compared with the traditional graph, the estimation graph has five main advantages: Bar chart Box diagram Dithering diagram Estimation diagram Avoid wrong dichotomy ✘ ✘ ✘ ✔ […]

  • The road of algorithmic customs clearance invites you to try it


    The new book has been published for some time and has received feedback from some readers. Today, let’s answer some common questions of readers and some content spoilers of the road of algorithmic customs clearance. In fact, after publication, many readers have read it and gave a very high-quality post reading feeling. Now I’ll choose […]

  • Root cause analysis of an abnormal exit of go micro service


    origin: https://github.com/x1nchen/bl… Table of Contents previously on Problem description Analyze the reason What exactly does the container stop this operation? How does go micro handle Linux signal? After the dichotomy code test and inspection, the problem after the process GOPs is found Solution summarize experience If you encounter a very interesting problem, record it here. […]

  • Algorithm learning: dichotomy from introduction to mastery


    Today, I saw a problem in Li Kou and wrote it down. I used the dichotomy and greedy algorithm. Here’s a record of my ideas. Binary search, also known as half search, is a search algorithm for finding specific elements in an ordered array. The search process can be divided into the following steps:(1) First, […]

  • Leetcode No.35 search insert position (c + + implementation)


    1. Title 1.1 English title Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algorithm with O(log n) runtime complexity. 1.2 Chinese title Given a sort […]

  • Square root of leetcode-069-x


    Square root of X Title Description: implement int sqrt (int x) function. Calculates and returns the square root of X, where x is a nonnegative integer. Since the return type is an integer, only the integer part of the result will be retained, and the decimal part will be rounded off. See leetcode’s official website […]

  • Leetcode No.167 two sum II – input array is sorted (c + + implementation)


    1. Title 1.1 English title Given an array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Return the indices of the two numbers (1-indexed) as an integer array answer of size 2, where 1 <= answer[0] < answer[1] <= numbers.length. […]

  • Algorithm | dichotomy


    In data structure books, the precondition of order is often added when introducing dichotomy. The definition of order is either from large to small or from small to large. So, is order really a necessary condition for using dichotomy in solving all problems?The answer is: No As long as the elimination logic on the left […]

  • Python’s case of finding the square root by dichotomy


    I’ll stop talking nonsense. Let’s look at the code directly~ ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 def sq2(x,e):   e = E error range   low= 0   high = max(x,1.0)Treatment greater than0less than1Number of   guess = (low + high) / 2.0   ctr = 1      while […]

  • Interview handwritten code list


    Anti chattering function const debounce = (fn, wait) => { let _ = ” return (…arg) => { clearTimeout(_) _ = setTimeout(() => { fn.apply(this, arg) }, wait) } } input.addEventListener(“input”, debounce(ajax, 1000)); Throttling function const throttle = (fn, s) => { let a = +new Date(), _ return (…arg) => { let b = +new Date() – a if (b > s) { _ = setTimeout(() => { fn(arg); _ = ” }, s) a = +new Date() } } } input.addEventListener(“input”, throttle(ajax, 1000)); Deep copy (solve circular reference) function clone(target, map = new WeakMap()) { if (typeof target === ‘object’) { let cloneTarget = Array.isArray(target) ? [] : […]