当前位置:网站首页>Personal deduction topic classification record

Personal deduction topic classification record

2022-07-07 08:54:00 Zero if

thinking

454. Add four numbers II
189. Rotation array
41. First positive number missing
253. Conference Room II
334. Increasing ternary subsequences
2195. Append... To the array K It's an integer
5253. Find the number of palindromes of the specified length

simulation

999. The number of pieces that can be captured in one step
Statistical asterisk
2105. Water the plants II
1503. The last moment before all the ants fall
1535. Find the winner of the array game

The prefix and

2100. Suitable for bank robbery
724. Find the central subscript of the array

Difference

2251. The number of flowers in the flowering period Good question
732. My schedule III
1589. The largest sum of all permutations
1674. The minimum number of operations to make arrays complementary
995. K The minimum number of turns for consecutive bits

Choose... Quickly

215. The... In the array K The biggest element

Line up three points

324. Swing sort II

Divide and conquer

395. There are at least K The longest substring of repeated characters It's also a double pointer
218. The skyline problem

Scan line

recursive

841. Keys and rooms

Stack

Simulation stack

5236. The minimum number of deletions to beautify the array

Monotonic stack

The finger of the sword Offer II 038. Daily temperature classic
1475. The final price after discount


Bend around a point
316. Remove duplicate letters
901. Stock price span


These three questions are a train of thought
84. The largest rectangle in the histogram
85. The largest rectangle
2104. Subarray range and


Hash

If the hash table dic
You can take dic The number in (val)

for(auto kv : dic)
{
    
	kv.second;
}

930. And the same binary subarray
350. Intersection of two arrays II
Interview questions 01.04. Palindrome arrangement

Two points search

The boundary problem

Binary search is nothing more than finding the maximum or minimum value

Maximum

Look for the right border , That is, the left side is consistent with the answer → Use a bisection template right_bound

 // Find the right border : The left side conforms to  →  For maximum 
    const check = (m)=>{
    } // Coincidence function 
    let [l,r] = [0,n-1] // Left and right 
    while(l < r){
    
        const m = Math.ceil((l+r)/2)  // Rounding up , Prevent rounding down l = m It's stuck 
        // Meet the requirements : All on the left meet the requirements 
        if(check(m)) l = m
        // Does not meet the requirements : All on the right do not meet the requirements 
        else r = m-1 
    } 

    if(check(l)) return l // Already found , You can add sentinel elements on the left , Make sure that the element can be found 
    else return -1// Can't find 

here l from 0 Start , In fact, it may not be found , So can I output l Made a check Judge , If false, In fact, it was not found , Not found 0 This position , So we need to return -1;

Of course, there is another way to start l = -1 Start looking for , Finally, there is no need to judge check, Direct judgment l == -1.

275. H Index II
[222. The number of nodes in a complete binary tree ](https://leetcode-cn.com/problems/count-
1292. The maximum side length of an element and a square less than or equal to the threshold complete-tree-nodes/)

minimum value

Looking for the left boundary , That is, the right side is consistent with the answer → Use a bisection template lower_bound

 // Find the left border : The right side conforms to  →  For the minimum 
    const check = (m)=>{
    } // Coincidence function 
    let [l,r] = [ Left , Right ] // Left and right 
    while(l < r){
    
        const m = Math.floor((l+r)/2) // Rounding down , Rounding up will be in r = m It's stuck 
        // Meet the requirements : All on the right meet the requirements 
        if(check(m)) r = m
        // Does not meet the requirements : All on the left do not meet the requirements 
        else l = m+1 
    } 
    if(check(l)) return l // Already found , You can add sentinel elements on the right , Make sure that the element can be found 
    else return -1 // Can't find 

436. Look for the right range


( Not limited to left and right pointers , It's just a question of dichotomy )
1608. The eigenvalues of a particular array
1898. The maximum number of characters that can be removed
1870. The minimum speed of a train arriving on time Decimal conversion , Division conversion is very useful
1283. The minimum divisor that makes the result not exceed the threshold
1712. The number of schemes that divide an array into three subarrays
1574. Delete the shortest subarray to make the remaining arrays ordered Personally, I feel the problem in dichotomy …

Pile up

I have made some summaries of many problems :
Heap & Big root pile :
Xiaogen == Big top == less< T > == return a < b; == Small priorities are high == There are smaller numbers in the heap, and the smaller the number, the more at the bottom of the heap == top What comes out is the top of the pile , Is the largest of the smaller values == pop What comes out is a larger value
Collocation top() pop(),, It is precisely because each time the priority is small , And throw out the ones with low priority

703. The... In the data stream K Big element
Interview questions 17.09. The first k Number
347. front K High frequency elements
973. Closest to the origin K A little bit
1337. The weakest in the matrix K That's ok
priority_queue q(greater<pair<int, int>>(), move(power)); Right quoting , strong
373. Look for the smallest K Pairs of numbers More uncomfortable question , Although it looks similar to the above two About pair There are answers to how to customize the comparison method
786. The first K The smallest prime fraction This question and the one above can experience customization pair How to write
778. Swimming in a rising pool
295. Median of data flow Two piles
1606. Find the server that handles the most requests

Search backtracking

Simple backtracking

1079. movable-type printing
200. Number of Islands classic
733. Image rendering
The finger of the sword Offer II 086. Split palindrome substring
756. Pyramid transformation matrix
The finger of the sword Offer II 085. Generate matching parentheses
1376. Inform all employees of the time required
784. All the letters are in uppercase and lowercase
386. Dictionary order number
529. The Minesweeper game

More complicated

417. The Pacific Atlantic current problem
52. N Queen II
1391. Check if there is a valid path in the grid Very winding …
LCP 31. Transformed maze

prune dfs

565. Array nesting
473. Match square 698 It's very similar to this , But the official added tests 698 Backtracking pruning timeout
301. Remove invalid brackets
60. Arrange the sequence
679. 24 Click game

to flash back + Pressure

1239. The maximum length of the concatenated string

Composition bfs

127. The word chain

Memory search

6110. The number of incremental paths in the grid graph The template questions
638. package
329. The longest incremental path in the matrix
140. Word splitting II

to flash back + dp·

131. Split palindrome string
741. Pick cherries

Game problem (dp)

486. Predicting Winners
877. Stone game These two are the same , however dfs Overtime , Should use the dp

BFS iteration

The finger of the sword Offer II 105. The largest area of the island classic
1254. Count the number of closed Islands First write 200 Better
1306. Jumping game III
1905. Statistical sub Islands
1091. Shortest path in binary matrix Generally, the shortest circuit is used BFS,DFS Will timeout

complex

433. Minimal genetic change

Fast power

50. Pow(x, n)

Double pointer

151. Invert words in string
349. Intersection of two arrays
832. Flipped Picture 0 become 1 ,1 become 0 grid[i][j] ^= 1;


18. Sum of four numbers
611. The number of effective triangles


Detour question

283. Move zero
581. The shortest unordered continuous subarray
838. Push domino
38. Look-and-say sequence
Interview questions 01.03. URL turn
Interview questions 16.16. Partial sorting
45. Jumping game II
541. Reverse string II
826. Arrange work to achieve maximum benefit

Speed pointer question

80. Remove duplicate items from an ordered array II
141. Circular list It's classic
142. Circular list II
202. Happy number
457. Whether there is a loop in the ring array It's a little twisted

Fixed boundary ()

340. At most K Longest substring of different characters
713. The product is less than K Subarray
1456. The maximum number of vowels in a fixed length substring

Two points

And , About this bisection interval .

>= All satisfied with , r =mid . therefore l < r.

875. Coco, who loves bananas
658. find K The closest element
1894. Find the number of students who need to add chalk
1498. The number of subsequences satisfying the condition
378. In order matrix K Small elements Two floors and two points , It's a little twisted

The sliding window

438. Find all alphabetic words in the string
1052. Angry Bookstore owners


1004. Maximum continuous 1 The number of IIIt
2024. The biggest trouble of the exam


Bucket thought

621. Task scheduler

Linked list

2. Addition of two numbers
86. Separate the list
138. Copy list with random pointer

An operation

Interview questions 01.01. Determine whether the character is unique

Pressure

1371. Each vowel contains an even number of times the longest substring
78. A subset of
90. A subset of II
216. Combinatorial summation III

847. The shortest path to access all nodes Pressure + BFS

Pressure dp(deep dark hard)

1994. The number of good subsets
698. Divided into k Equal subsets odd questions , It's not easy to analyze

character string

Interview questions 01.09. String rotation
2109. Add spaces to the string

Stack simulation

394. String decoding

Palindrome string

125. Verify the palindrome string
5. Longest text substring dp
131. Split palindrome string
564. Looking for the latest palindromes
5237. Get the minimum number of operations of the palindrome string It's more like a recursive problem

String operations

415. String addition The template questions
43. String multiplication

Trees

Power button auto Linked list or tree structure with pointer , Don't change the value
Do not use auto&

Binary tree

2196. Create a binary tree according to the description

Sequence traversal

102. Sequence traversal of binary tree
103. Zigzag sequence traversal of binary tree
116. Fill in the next right node pointer for each node

The first sequence traversal

114. The binary tree is expanded into a list
297. Serialization and deserialization of binary trees

In the sequence traversal

98. Verify binary search tree

Binary search tree

938. The range of binary search tree and
108. Convert an ordered array to a binary search tree
98. Verify binary search tree

Trees + dfs( recursive )

111. Minimum depth of binary tree


112. The sum of the paths
113. The sum of the paths II
It's better for these two to study together


95. Different binary search trees II

Trees + bfs( iteration )

1609. Even tree


Building tree

654. The largest binary tree

chart

Simple questions

1042. Don't plant flowers next to each other

bfs

5300. All ancestors of a node in a directed acyclic graph More like bfs
1466. Rerouting
2039. When the network is idle

A topological sort


207. The curriculum
210. The curriculum II And The finger of the sword Offer II 113. Course sequence equally


1462. The curriculum IV
2050. Parallel courses III Topology + dp
2049. Count Nodes With the Highest Score
802. Find the ultimate security state
310. Minimum height tree
269. Mars Dictionary vip
1591. Strange printer II hard
913. Tom and Jerry It's a little difficult

Union checking set


One way
261. To judge a tree Tplus
684. Redundant connections


399. Divide and evaluate


6106. Count the logarithm of points that cannot reach each other in an undirected graph
947. Remove the most stones in the same row or row Union checking set + Hash
1319. The number of connected network operations
959. Area by slash It's very similar to the one above , It's just that it's not easy to find out how to combine


A little harder
721. Account consolidation Very winding , But it's still a joint search
1202. Exchange elements in a string A little bit , Good question
924. Minimize the spread of malware

shortest path

Dijkstra

743. Network latency The template questions
1631. Minimum energy consumption path A little difficult
2203. Get the minimum weighted subgraph of the required path Good question !!!

bellmen ford

787. K The cheapest flight in the transfer station

dp

85. The largest rectangle
1526. The subarray forming the target array should be increased at least several times

linear dp

6100. Count the number of ways to place the house
53. Maximum subarray and classic
6103. Remove the minimum fraction of edges from the tree 53 Variants

Tree form dp

337. raid homes and plunder houses III
96. Different binary search trees

matrix dp

Interview questions 17.23. Maximum black square matrix

mathematics

166. Fractions to decimals
390. Eliminate the game

Data structure design

Dictionary tree

211. Add and search words - Data structure design
133. Clone map
146. LRU cache

原网站

版权声明
本文为[Zero if]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070619048887.html