Graph theory - cf1495d. BFS trees (graph theory shortest path spanning tree + enumeration count + tree hierarchy)

General idea of the topic Main idea of the title: Problem solving ideas: First, we must find the shortest path between any two points → F l o y e ...

Posted by Dada78 on Sat, 18 Sep 2021 09:22:52 -0700

Learning notes of data structure, algorithm and application - C + + language description - priority queue - Zuo gaoshu

1, Zuo gaoshu The heap structure learned earlier is an implicit data structure. The heap represented by a complete binary tree is stored implicitly in an array (i.e. no explicit pointer or other data can be used to reshape this structure). Because there is no storage structure information, this representation method has high space utilizat ...

Posted by Kower on Sat, 18 Sep 2021 09:08:34 -0700

Netease written test 4 questions

1. Divide the goods equally Now there are n items, and each item has a value. Now I want to distribute these items to two people. It is required that the total value of the items distributed by each of the two people is the same (the number can be different, and the total value can be the same). The remaining items need to be thrown away. Now ...

Posted by rrhody on Sat, 18 Sep 2021 06:56:33 -0700

2021 AI driving of Shanghai saih. Jige (two point answer)

I can only say that I'm too delicious. I really can't think of it at all. If you simply want to find this collision combination, it is very difficult. So consider the overall situation. If two cars collide, the relative position of the two cars has changed. What we are looking for is that he must surpass the nearest left or right cars of diffe ...

Posted by tbales on Fri, 17 Sep 2021 21:50:53 -0700

7, Binary tree: the maximum depth of a binary tree

After reading this article, you can do the following two questions together: 104. Maximum depth of binary tree559.n maximum depth of fork tree Force button topic link (opens new window) Given a binary tree, find its maximum depth. The depth of the binary tree is the number of nodes on the longest path from the root node to the farthest ...

Posted by lathifmca on Fri, 17 Sep 2021 21:36:26 -0700

Netease 2021 autumn recruitment written test real question

1. Minimum digit sum [Title Description] define S(n), which represents the sum of each digit of N in decimal system. Now, given an X, please find the minimum positive integer n, which satisfies x ≤ S(n) Enter description The number of data groups in the first row is T, and for each group of data, one number x per row. 1≤x≤105,1≤T≤10 Ou ...

Posted by socalnate on Fri, 17 Sep 2021 17:31:42 -0700

[out of order version ● sword finger offer] daily algorithm problem punch in problem solution - dynamic programming (topic No. 42,46,47,48)

Punch in day7 Question 1: Sword finger Offer 42. Maximum sum of continuous subarrays Enter an integer array. One or more consecutive integers in the array form a sub array. Find the maximum value of the sum of all subarrays. The required time complexity is O(n). Example 1: Input: num = [- 2,1, - 3,4, - 1,2,1, - 5,4] Output: 6 Explana ...

Posted by GravityFX on Fri, 17 Sep 2021 09:19:17 -0700

Beginner algorithm brush Day4

Maximum Square: the idea is to solve it by dynamic programming. Traverse all possible lengths, regard each point in the matrix as the lower right corner of the square under this length, and judge whether there is a square with this point as the lower right corner under the current length. DP[i][j] is equal to the area. The judgment condition is ...

Posted by knucklehead on Fri, 17 Sep 2021 07:55:34 -0700

[line segment tree] [interval LCM] forced on-line repair interval LCM

Description Give a length of   n   Sequence of   a. Need to execute   m   Operations: -1   x   y: Let a[x]=y - 2   l   r: Answer interval [l,r]   LCM, more specifically, output LCM(a[l],a[l+1],... a[r − 1],a[r]) LCM(x,y)   by   x   and   y   Minimum common mult ...

Posted by tamilmani on Fri, 17 Sep 2021 07:44:48 -0700

Interview question 01.04. Palindrome arrangement

subject Given a string, write a function to determine whether it is one of the permutations of a palindrome string. Palindrome strings refer to words or phrases with the same positive and negative directions. Arrangement refers to the rearrangement of letters. Palindrome strings are not necessarily words in the dictionary. Example ...

Posted by TheDefender on Fri, 17 Sep 2021 04:24:44 -0700