Simplified Chinese | English
Our slogan is: Only by mastering basic data structures and algorithms can we be able to handle complex problems with ease.
My new book "The Road to Algorithmic Clearance" has been published.
Physical version book purchase link 1
Physical version book purchase link 2
Electronic book purchase link
https://github.com/fe-lucifer/fanqiang
Likou’s free questions already have many classic ones, covering all question types, but many companies’ real questions are locked. Personally, I think if you are looking for a job, you can buy a membership. In addition, there are many leetbooks that can be viewed by members. Combined with the study plan, the efficiency is quite high.
Now Liquou has launched a plus membership challenge based on one question per day. You can earn points by completing the questions every day, and the points can be exchanged for Liquou peripherals.
If you want to buy a Leetcode membership, here is my exclusive Leetcode discount: https://leetcode.cn/premium/?promoChannel=lucifer (Annual members will get two extra months of membership, and quarterly members will get two extra weeks of membership)
Many educational institutions promote algorithmic interviews in 7 days and a month. I have probably understood it, but it is not very reliable. Learning algorithms still requires accumulation. Without quantitative changes, there can be no qualitative changes. Some people choose to read books, which is a good choice. However, many people choose outdated or poor-quality books, or they do not know how to write the exercises given in the book, resulting in poor results.
Based on these reasons, I organized a 91-day test-taking activity, giving the latest learning path through a relatively long period of time (91 days), and forcing everyone to check in, a high-intensity exercise, so that everyone can meet each other after 91 days A better version of yourself . Detailed event introduction can be viewed by clicking the link below. In addition, the lecture notes from previous issues are also below. You can see if they suit your taste.
Finally, I would like to give you a message: If you persist, you will suddenly grow up one day .
Click here to participate
If you feel that the above group activities are relatively inefficient, I currently also accept 1v1 algorithm coaching. The price depends on your algorithm foundation and the content you want to learn. If you are interested, you can add me on WeChat, remark "Algorithm Coaching", WeChat ID: DevelopeEngineer .
Leetcode problem solving, record your own leetcode problem solving path.
This warehouse is currently divided into five parts:
The first part is the analysis of classic leetcode questions, including ideas, key points and specific code implementations.
The second part is a summary of data structures and algorithms.
The third part is anki cards. The leetcode questions are recorded in anki in a certain way to facilitate everyone's memory.
The fourth part is a daily question. The daily question is an activity carried out in communication groups (including WeChat and QQ). Everyone solves a question together, so that the discussion is more focused and more feedback will be obtained. Moreover, these questions can be recorded and will be filtered and added to the solution module of the warehouse in the future.
The fifth part is the plan. Here we will record the content that will be added to the above three parts in the future.
Note: The e-book here is not the electronic version of "The Road to Algorithmic Clearance", but the electronic version of the contents of this warehouse!
Read address online
Free download for a limited time! Fees may be charged at any time later
You can go to the backend of my official account "Likoujiajia" to reply and get the e-book!
epub still has animations
In addition, some content is only released on the official account, so if you think the content is good, you can pay attention to it. It would be even better if you give ➕ another star!
(Picture from leetcode)
Among them, the algorithms are mainly the following:
Data structures mainly include the following:
I found an "Interview Cheat Sheet" online. This PDF lists the template steps for an interview. , with detailed step-by-step instructions on how to complete the interview.
This PDF mentions three criteria for good code at the beginning:
This is so well written.
Next, 15 steps of algorithm interview are listed. For example, Step 1: After the interviewer has finished asking questions, you need to first write down the key points (and then write comments and code below). My feeling after reading this is that as long as you follow this during the interview, the success rate will increase.
Maybe it’s a browser extension that can change your question-answering efficiency.
Plug-in address: https://chrome.google.com/webstore/detail/leetcode-cheatsheet/fniccleejlofifaakbgppmbbcdfjonle?hl=en-US.
Friends who cannot access the Google Store can go to my official account to reply to the plug-in to get the offline version. It is strongly recommended that you use the Google Play Store to install, so that if there are updates, they can be installed automatically. After all, our plug-ins are updated quite quickly.
In addition, you can also use the website developed by zerotrac to calculate the scores of successful questions. The score here refers to the competition score. You can choose questions slightly higher than your own competition score to practice based on your competition score. Note that this is only an estimated score calculated based on the number of people who have passed. Address: https://zerotrac.github.io/leetcode_problem_rating/
Here are only representative topics , not all topics
At present, more than 200 question solutions have been updated, and including questions related to special topics, there are almost 300 questions .
The difficulty of the questions here is relatively low, and most of them are simulation questions, or questions whose solutions are easy to see. In addition, simple questions can generally be solved using brute force methods. At this time, just look at the data range and think about the complexity of your algorithm.
Of course, it is not ruled out that many hard questions can also be violently simulated. Just pay more attention to the data range.
The following are the classic questions I listed (the words marked with 91 are from the 91 Tianxue Algorithm Activity):
Interview question 17.12. BiNode?
0001. Sum of two numbers
0020. Valid parentheses
0021. Merge two ordered linked lists
0026. Remove duplicates in sorted array
0053. Maximum subsequence sum
0066. plus one 91
0088. Merge two sorted arrays
0101. Symmetric binary tree
0104. Maximum depth of binary tree
0108. Convert ordered array to binary search tree
0121. The best time to buy and sell stocks
0122. The best time to buy and sell stocks II
0125. Verify palindrome string
0136. A number that appears only once
0155. Minimum stack?
0160. Intersected linked list 91
0167. Sum of two numbers II input ordered array
0169. Most elements
0172. Zero after factorial
0190. Reverse binary bits
0191. Number of bits 1
0198. Robbery
0203. Remove linked list elements
0206. Reverse linked list
0219. Duplicate elements exist II
0226. Flip a binary tree
0232. Use stack to implement queue? 91
0263. Ugly numbers
0283. Move zero
0342. Power of 4?
0349. Intersection of two arrays
0371. Sum of two integers
401. Binary Watch
0437. Path Sum III
0455. Distribute cookies
0504. Seven base number
0575. Share candy
0606. Create a string based on a binary tree
0661. Image smoother
0665. Non-decreasing sequence
821. The shortest distance between characters 91
0874. Simulated walking robot
1128. Number of equivalent domino pairs
1260. 2D mesh migration
1332. Delete palindromic subsequences
2591. Give money to the most children
The medium-level questions have the largest proportion of deductions, so I have the most solutions to this part. Don't pursue difficult problems too much. First, master the medium-difficulty questions before moving on.
This part of the questions requires us to dig out the information contained in the questions and abstract them into simple questions. Or there are some questions that are more troublesome to write, and some people fail because of their poor coding skills. Therefore, everyone must do it by themselves. Even if they “understand” it after reading the solution, they still have to code it themselves. Unless you write it yourself, you will never know the details inside.
The following are the classic questions I listed (the words marked with 91 are from the 91 Tianxue Algorithm Activity):
Interview question 17.09. kth number
Interview question 17.23. Maximum black square matrix
Interview question 16.16. Partial ordering
Increasing Digits?
Longest Contiguously Strictly Increasing Sublist After Deletion?
Consecutive Wins
Sort-String-by-Flipping
Number of Substrings with Single Character Difference
Bus Fare?
Minimum Dropping Path Sum
Longest-Matrix-Path-Length
Every Sublist Min Sum
Maximize the Number of Equivalent Pairs After Swaps
0002. Add two numbers
0003. The longest substring without repeated characters
0005. The longest palindrome substring
0011. The container that holds the most water
0015. Sum of three numbers
0017. Telephone number alphabet
0019. Delete the Nth node from the bottom of the linked list
0022. Bracket generation
0024. Exchange nodes in the linked list pairwise
0029. Divide two numbers
0031. Next arrangement
0033. Searching a rotated sorted array
0039. Combination sum
0040. Combination Sum II
0046. Full arrangement
0047. Full arrangement II
0048. Rotate image
0049. Alphabet anagram grouping
0050. Pow(x, n) ?
0055. Jumping Game
0056. Merge interval
0060. The kth permutation?
0061. Rotating linked list 91
0062. Different paths
0073. Matrix zeroing
0075. Color classification?
0078. Subset
0079. Word search
0080. Remove duplicates in sorted array II
0086. Separate linked list
0090. Subset II
0091. Decoding method
0092. Reverse linked list II
0094. In-order traversal of binary tree?
0095. Different Binary Search Trees II
0096. Different binary search trees
0098. Verify binary search tree
0102. Level-order traversal of binary tree
0103. Zigzag level traversal of binary tree
0113. Path Sum II
0129. Find the sum of the numbers from the root to the leaf nodes?
0130. Surrounded area
0131. Split palindrome string
0139. Word splitting
0144. Preorder traversal of binary tree
0147. Insertion sort on linked list
0150. Reverse Polish expression evaluation
0152. Product maximum subarray
0153. Find the minimum value in a rotated sorted array
0199. Right view of a binary tree?
0200. Number of islands?
0201. Bitwise AND of numeric ranges
0208. Implement Trie (prefix tree)
0209. Subarray with minimum length
0211. Adding and searching words-data structure design
0215. The Kth largest element in the array
0220. Presence of repeated element III
0221. Maximum square
0227. Basic Calculator II
0229. Find the mode II
0230. The Kth smallest element in the binary search tree
0236. The most recent common ancestor of a binary tree
0238. Product of arrays other than itself
0240. Searching two-dimensional matrices II
0279. Perfect square number
0309. The best time to buy and sell stocks includes the freezing period
0322. Change exchange?
0324. Swing Sort II
0328. Odd and even linked list
0331. Verify preorder serialization of binary trees
0334. Increasing ternary subsequence
0337. Robbery III
0343. Integer split
0365. Kettle problem
0378. Kth smallest element in ordered matrix
0380. Constant time insertion, deletion and retrieval of random elements
0385. Mini parser
0394. String decoding 91
0416. Split equal sum subsets
0424. The longest repeated character after replacement
0438. Find all anagrams of letters in a string
0445. Adding two numbers II
0454. Addition of Four Numbers II
0456. 132 mode
0457.457. Is there a loop in the circular array?
0464. Can I win?
0470. Implement Rand10 using Rand7()
0473. Matches make a square?
0494. Goals and
0516. The longest palindrome subsequence
0513. Find the value 91 in the lower left corner of the tree
0518. Change Exchange II
0525. Continuous array
0547. Number of provinces
0560. Subarray whose sum is K
0609. Find duplicate files in the system
0611. Number of valid triangles?
0673. Number of longest increasing subsequences
0686. Repeated stacked string matching
0710. Random numbers in the blacklist
0714. The best time to buy and sell stocks including handling fees
0718. Longest repeating subarray
0735. Planetary collision?
0754. End number reached
0785. Judgment of bipartite graphs
0790. Domino and Tomino tiling
0799. Champagne tower
0801. Minimum number of exchanges to increment the sequence
0816. Fuzzy coordinates
0820. Compression encoding of words
0838. Push domino
0873. The length of the longest Fibonacci subsequence
0875. Keke who loves bananas
0877. Stone Game
0886. Possible Dichotomy
0898. Bitwise OR operation of subarrays
0900. RLE iterator
0911. Online elections
0912. Sorting array
0918. Maximum sum of circular subarrays?
0932. Beautiful array
0935. Knight Dialer
0947. Remove the most stones in the same row or row
0959. Areas divided by slashes
0978. Longest turbulence subarray
0987. Vertical order traversal of binary tree 91
1004. Maximum number of consecutive 1's III
1011. Ability to deliver package within D days
1014. Best sightseeing combination
1015. The smallest integer divisible by K
1019. The next larger node in the linked list
1020. Number of enclaves
1023. CamelCase matching
1031. Maximum sum of two non-overlapping subarrays
1043. Split an array to get maximum sum
1053. Previous permutation exchanged once)
1104. Binary tree pathfinding
1129. Shortest path with alternating colors
1131. Maximum value of absolute value expression
1138. Path on the alphabet board
1186. Delete once to get the maximum sum of the subarray
1218. Longest definite difference subsequence
1227. What is the probability of aircraft seat allocation?
1261. Finding elements in a tainted binary tree
1262. The largest sum divisible by three
1297. The maximum number of occurrences of a substring
1310. Subarray XOR query
1334. The city with the fewest neighbors within the threshold distance
1371. The longest substring containing an even number of times each vowel
1381. Design a stack that supports incremental operations 91
1423. Maximum number of points obtainable
1438. The longest continuous subarray whose absolute difference does not exceed the limit
1558. Get the minimum number of function calls for the target array
1574. Delete the shortest subarray to make the remaining array sorted
1589. Maximum sum among all permutations
1631. Minimum physical consumption path
1638. Count the number of substrings that differ by only one character
1658. Minimum number of operations to reduce x to 0
1697. Check if path with edge length limit exists
1737. The minimum number of characters that need to be changed to satisfy one of the three conditions?
1770. Maximum fraction to perform multiplication? 91
1793. Maximum score of good subarrays
1834. Single-threaded CPU
1899. Merge several triples to form a target triple?
1904. Number of complete games you have completed
1906. Query the minimum value of the absolute value of the difference
2007. Restoring original array from double array
2008. Maximum Taxi Profit
2592. Maximizing the great value of an array
2593. Score of array after marking all elements
2817. Minimum absolute difference between elements under constraints
2865. Beautiful Tower I
2866. Beautiful Tower II
2939. Maximum XOR product
5935. A good day to rob a bank
5936. The most bombs detonated
5965. Sum of intervals of the same elements
6021. Maximum number of substrings in a string
In terms of types, difficult questions are mostly:
In terms of solutions, most of them are:
Logically speaking, it's either very difficult to think of or very difficult to code. Because sometimes multiple algorithms need to be combined, this part of the question is the most difficult.
Here I have summarized a few tips:
The following are the classic questions I listed (the words marked with 91 are from the 91 Tianxue Algorithm Activity):
LCP 20. Rapid Transit
LCP 21. Chase game?
Number Stream to Intervals
Triple Inversion 91
Kth Pair Distance 91
Minimum Light Radius 91
Largest Equivalent Set of Pairs?
Ticket-Order.md
Connected-Road-to-Destination
0004. Find the median of two positively ordered arrays?
0023. Merge K ascending linked lists
0025. A set of K flip linked lists?
0030. Concatenate substrings of all words
0032. Longest valid bracket
0042. Catching rainwater
0052. N Queen II
0057. Insert interval
0065. Valid figures
0084. The largest rectangle in the histogram
0085. Maximum rectangle
0087. Scramble the string
0124. Maximum path sum in binary tree
0128. The longest continuous sequence
0132. Split palindrome string II?
0140. Word Splitting II
0145. Post-order traversal of binary tree
0146. LRU caching mechanism
0154. Finding the Minimum Value in a Rotated Sorted Array II
0212. Word Search II
0239. Maximum value of sliding window?
0295. Median of data stream
0297. Serialization and deserialization of binary trees 91
0301. Remove invalid brackets
0312. Poke the balloon
330. Complete the array as required
0335. Path crossing
0460. LFU cache
0472. Connective words
0480. Sliding window median
0483. Minimum good base
0488. Zuma Game
0493. Flip pair
0664. Strange printer
0679. Blackjack Game
0715. Range module?
0726. Number of atoms
0768. The maximum number of blocks that can be sorted is II 91
0805. Mean split of array
0839. Similar string groups
0887. Egg dropped
0895. Maximum frequency stack
0909. Snakes and Ladders
0975. Odd-even jump
0995. Minimum number of flips of K consecutive bits
1032. Character stream
1168. Optimization of water resources allocation
1178. Word guessing puzzle
1203. Project Management
1255. The set of words with the highest score
1345. Jumping Game IV
1449. The sum of digital costs is the largest number of target values.
1494. Parallel Course II
1521. Find the function value closest to the target value
1526. Minimum number of increments of subarrays forming the target array
1639. The number of options to construct the target string through the given dictionary new
1649. Create ordered array through instructions
1671. Obtain the minimum number of deletions of the mountain array
1707. Maximum XOR value with the elements in the array
1713. Minimum number of operations to obtain subsequence
1723. Minimum time to complete all work
1787. Make the XOR result of all intervals zero
1835. XOR sum of bitwise AND results of all number pairs
1871. Jump Game VII?
1872. The Stone Game VIII
1883. Minimum number of skipped breaks to arrive at the meeting on time
1970. The last day you can cross the matrix
2009. Minimum number of operations to make an array contiguous
2025. Maximum number of ways to split an array
2030. Minimum subsequence containing specific letters
2102. Sequence order query
2141. The longest time to run N computers at the same time
2179. Count the number of good triples in an array?
2209. Minimum white bricks after covering them with carpet?
2281. The total power of wizards and
2306. Good questions on company naming enumeration optimization
2312. Classic dynamic programming problem of selling wood blocks
2842. Count the maximum number of beautiful values of k subsequences of a string
2972. Count the number of removed increasing subarrays II
3027. Number of plans for personnel positions II
3041. Maximize the number of consecutive elements in the array after modifying the array
3082. Find the energy sum of all subsequences
3108. The minimum cost of traveling with Quan Tuli
3347. Highest frequency of element after performing operation II
3336. Number of subsequences with equal greatest common divisors
Anki is mainly divided into two parts: one is the mapping of key points to questions, and the other is the mapping of questions to ideas, key points, and codes.
All cards are in anki-card
How to use:
anki - File - Import - Select "Packaged Anki Collection" in the drop-down format, then select the file you downloaded and confirm.
For more information about how to use anki, please check the anki official website
You can also add me as a WeChat friend to communicate!
2019-07-10: A short article to commemorate the project Star breaking through 1W, recording the "rise" of the project. If you are interested, you can take a look. If you are interested in this project, please click Star . The project will continue to be updated . Thank you Everyone’s support.
2019-10-08: To commemorate the LeetCode project Star breaking through 2W, and Github search for "LeetCode" ranked first.
2020-04-12: The project exceeded 30,000 stars.
2020-04-14: The official website力扣加加
now online. It has special explanations, one question per day, download area and video solution. More content will be added in the future. Don’t hurry up and collect it? Address: http://leetcode-solution.cn/
I wrote a guide on how to submit solutions
Thanks to all the friends who contributed to this project
CC BY-NC-ND 4.0