Jianzhi Offer interview question: 09 rebuild binary tree

The algorithm is not the hard core "Nine Yang Sutra" in Jin Yong's martial arts novels, nor the lightweight "Lingbo micro step" ", which is the basic skill of programmers, just as people who practice martial arts need to take a horse step. Whether the Kung Fu is good or not depends on whether the horse step is not solid ...

Posted by icedude on Sat, 29 Jan 2022 23:58:27 +0100

Blue Bridge Cup algorithm training to get gold coins (DP recursive method)

Problem description There is an N x N square. Each square has some gold coins. You can get the gold coins as long as you stand in the square. You stand in the top left corner of the grid, and you can walk from one grid to its right or lower grid at a time. How can I get the most gold coins. Input format On the first line, enter a positive ...

Posted by Zup on Sat, 29 Jan 2022 21:04:32 +0100

auc computing logic

1. auc meaning AUC (Area under curve) is a commonly used two classification evaluation method for machine learning. It directly means the area under the ROC curve, as shown in the following figure   The column in the table represents the forecast classification, and the row represents the actual classification:Actual 1, forecast 1: real ...

Posted by dpsd on Sat, 29 Jan 2022 20:16:59 +0100

[data structure notes] B tree and B + tree, hash in STL_ Map and unordered_map container usage

B and B + trees B tree and B + tree are data structures used for external search, and they are balanced multi-channel search trees. The differences between the two are as follows: 1. In B + tree, the node with n keywords contains n subtrees, that is, each keyword corresponds to a subtree, while in B tree, the node with n keywords contain ...

Posted by dvdflashbacks on Sat, 29 Jan 2022 18:45:04 +0100

7 questions to solve the binary search problem

The sequential array searches for a value The basic idea of binary search is that the search interval must be orderly In this paper, all search is based on the closed interval. At this time, the condition in while should be written as l < = R If you search by the open interval (r=nums.size()), the condition in while should be written ...

Posted by erax on Sat, 29 Jan 2022 17:59:15 +0100

A Jun takes you to use the Kotlin brush algorithm

This series uses Java and Kotlin to solve the above algorithm problems. Because I am a rookie in the algorithm, some problems may not be the optimal solution. I hope to discuss with you~ GitHub of the project: Algorithm Two Sum Difficulty: simple Link: Two Sum code Java import java.util.Arrays; import java.util.HashMap; import java.util. ...

Posted by xxtobirichter on Sat, 29 Jan 2022 17:49:34 +0100

Interval maintenance (tree array)

Problem Description: Title Description Problem solving ideas: The basic knowledge of tree array will not be repeated here. We only need to know that it can deal with interval maintainability and modifiable RMQ problems, which is more efficient. The following is the operation of segment tree Single point modification void update(int x,in ...

Posted by franknu on Sat, 29 Jan 2022 15:26:36 +0100

2022 Niuke winter vacation algorithm basic training camp

Title Link preface I cooked a chicken and wrote that I went to eat halfway (I can't write the questions after I don't eat...), and I will make up the questions later Attached Official explanation A zhinai's Hello XXXX Problem solution Nothing to say, direct output code print("hello ") B zhinai buys melons Problem solution / idea ...

Posted by lobo235 on Sat, 29 Jan 2022 13:04:47 +0100

Algorithm problem summary

catalogue 1. Sum of consecutive numbers ​ thinking Code display  2. Award a medal Train of thought Code display 3. Perfect cube Train of thought Code display 4. Buying chicken thinking Code display 5. Cow story thinking Code display 6. The heating is broken thinking Code display   1. Sum of consecutive numbers ...

Posted by Gwayn on Sat, 29 Jan 2022 12:22:24 +0100

Leetcode brush questions, simple + medium questions (issue 36)

catalogue Question 1: continuous subarrays and Question 2: continuous array Question 3: intersecting linked list Question 4: goals and objectives Question 5: weight of the last stone II Question 6: constructing rectangles Question 7: change II Question 8: complete square Question 9: different paths II Question 10: stone game Leetcod ...

Posted by opido on Sat, 29 Jan 2022 11:54:40 +0100