3

Preface

Hello everyone, I’m bigsai, long time no see! Today, I will share with you some small methods of my own brushing and force button. It may not be very useful but you can refer to it. I wish you more efficient and stronger!

Recently, one of the problems encountered in some group chats and private chats is: problem solving. Everyone also pays attention to the importance of algorithm problem solving to impact on big factories. More and more people are starting to curl up!

BA321C5AFE6864CE60465A0E7A3DB133

But some people roll it up like this, and they feel confused.

20404222C6C4C33D6665B8A077A597A1

Today, I will talk about my personal perspectives on various problems for beginners.

What questions do you brush?

We brush power button, be sure the goal is to impact the interview written test manufacturers, small part of the problem is to insist on keeping brush algorithm programming to enhance their ability to feel, then you definitely want Highlights first master, which is the focus of content?

refers to the offer:

The first is offer (16177b592beeae https://leetcode-cn.com/problem-list/xb9nqhhg/), the priority of Jianzhi offer is still very high, and employment must be brushed. You can apply for Sword Finger offers on both Niuke and Likou platforms, but I personally recommend Likou this platform. The first time I applied for Sword Finger offers, I used it with everyone on the Niuke platform (although it took a while I don’t know if anyone remembers it), but some of the questions (rarely) submitted my code from a long time ago and found wa when I tried to submit my code a long time ago. Therefore, the Niuke test data is relatively weak, and the test data on Likou is relatively large. In most cases, there are basically no logical loopholes in the code after you pass the code.

In addition to the reputation of Jianzhi offers, one of the reasons why I recommend you to use Jianzhi offers is that the topic of Jianzhi offers is really classic! Just over sixty questions, covering common data structures such as linked lists, binary trees, graphs, queues, stacks, hash tables, etc., common algorithms and classic problems include over-division, dynamic programming, full arrangement problems, sliding windows, Greedy, divide and conquer, sorting, bitwise operations, dfs, bfs, etc. After completing these questions, you can really gain and learn a lot!

On the other hand, the sword refers to the fact that the offer appears in the interview written test. is very high-frequency . The questions that the interviewer examines are generally classic questions. The interviewer does not create questions, but only selects questions, and the topics of the selection are basic. It is the question of Likou and Jianzhi offer. Jianzhi offer is one of the very high-frequency question banks.

image-20211018160404291

Force button HOT100 | Force button front 200

: 16177b592bef45 https://leetcode-cn.com/problem-list/2cktkvj/ 16177b592bef47

top 200: 16177b592bef5c https://leetcode-cn.com/problemset/all/

Give priority to HOT100. HOT100 is 100 high-quality questions selected from the question bank for a certain period of time (because the number of questions is increasing). These questions are similar to Jianzhi offers, and they are all high-frequency questions. It is really difficult to have fewer problems, and it is especially easy for many people to get stuck. But if the HOT100 can be used to finish, then you can actually add the amount of questions that the Jianzhi offer is as fast as 200.

There are already two or three thousand questions about Likou, and it is still increasing, so it is almost impossible to finish reading Likou. If you want to do it in order, we recommend the first 200. The first 200 of Likou and Likou HOT100 overlap very well. Large, the quality of the first two hundred is still very high (it does not mean that the quality of the latter is not high, but that there will be many problems of the same type and the same routine after the big question bank is brushed), so it is recommended to brush the top 200.

After brushing these parts, you can probably have close to 300 high-quality questions, . I think it is enough to deal with most Internet company interviews, and some changes can be seen relatively easily by myself.

The order of rewriting questions?

The question bank to be brushed is listed above. Now that you know which questions to brush, is there a more recommended order for brushing the questions? Do you need a classification brush?

Whether it is to be classified by topic or not, I think it depends on people.

If you have a foundation in data structure and algorithms, such as postgraduate entrance examinations or normal data structure studies, common data structures and algorithm principles can be realized, or some experience in brushing questions, then I recommend that you just brush it in order and it is over. offer are difficult, and some require advanced data structures, but more are clever thinking questions based on 16177b592bf02e data structure or logic, and more , if you have data The basis of structure and algorithm is relatively easy for you to get to the inspection point. When you encounter a skill or data structure that you don’t know, learn to add it to your own "brain bank".

If you are a real noob, then you have to manually find a walkable path for yourself, then I recommend that you can follow some special topics to break each one. Because you are Xiaobai, if you can't do this problem in order, you have learned it, and you have learned a completely strange new thing after you have solved the next problem. Without a foundation, learning too many new and unfamiliar things in a short period of time is difficult to absorb, and it is easy to forget. So you can think of brushing as a step, climbing up layer by layer, and just started looking for easy easy a+b type questions. For data structure questions, start from the linked list and learn through the implementation of insertion and deletion of singly linked lists, double linked lists, and circular linked lists, and then find the linked list related questions in the question bank to break them one by one (the linked list can also be subdivided into and deleted from the linked list. , Reversing, merging, searching, sorting, etc.), after the big topic of the linked list, the big topic of the binary tree, the hash... In this way, you can learn a certain data structure or algorithm technique in a short time, and it is better to brush more questions to consolidate the absorption effect! In this case, don’t just think it’s simple and just rush, if you don’t type the code, you may not know what problems you will have.

Three why

Why do I have no idea when I see a question?

This situation is likely to be due to the fact that there is less seeing, and it is a slow process to write questions. If you see more, you will feel faster. There may also be partly because the route for brushing questions for myself is not peaceful enough. It's not normal for you to get up and down hard without thinking.

Simple questions are easy to understand and difficult to implement?

In this case, the basic logic may lack training, and the mastery of the collective framework of the programming language may also be lacking. Some questions may involve various nesting and linkage of collection frameworks (Map, Set, List, Stack, Queen), which require you to have a clear sense of hierarchy and logic.

You need to be proficient in using a programming language, familiar with the common operation api, collection framework, and functions of this programming language. These are problem-solving tools to help us improve efficiency (not to write a queue or a hash table every time Bar).

For this question, I recommend you to brush a few simple string processing problems first. Many string processing problems involve a lot of collection frameworks and logic controls. If there is enough time, it is recommended to brush some PAT level B topics to practice logic and programming language mastery.

read a lot of problem solutions, why still can't solve the problem?

After reading a lot of questions, there is not much difference between it and no answer, and the impression is weak. From a learning point of view, the way we learn mathematics is a bit similar to the way we learn mathematics. We have learned the formulas and examples of math problems, but it takes a lot of practice to really master it.

Only when I personally typed every line of code, what is the logic of each line of code, I thought it out myself rather than understood the thinking of others. The entire program is completely implemented from 0 to 1, so that it can be a complete logic, and then various bugs may appear to debug by yourself to find out the problem.

You can look at the solution of the problem. If you read it, you need to be able to write it out completely. If you have read more than 1000 questions, it is okay if you read the solution. But if the brush is less than 100, then you honestly understand or follow someone else's logic closed book type of reproduction again . If you don't realize it, there are many problems, and it's not surprising that you can't remember.

To sum up, if the number of questions is less than 100, you feel that the status is not good, then simply and rudely and more questions first. If the status is still very poor after two or three hundred, then you have to look for other reasons.

The process of getting a question

What is the correct method of brushing and learning when I get a question?

Determine inspection points and determine ideas

After reading a question, the first thing after reading the meaning of the question is to understand what the content of the question is? Of course, if you follow the topic to brush, it may be much easier in this regard. First of all, you can determine whether the next problem type is graph theory, binary tree, string, and a bunch of data given by the most common arrays. It is necessary to take this type of question to look at the common algorithms in this area. For example, for an array of data for you to find and calculate, it may be a double pointer, it may be a hash, it may be a bit operation, it may be dynamic programming, or it may be greedy processing. However, most of the questions are based on the classic problems of each classic algorithm. You need to know which classic problems the classic algorithm handles.

If you can determine the inspection point, you can think about the details and start to realize it; if you can't determine the inspection point and you have no idea, don't look at the solution directly. Look at the hint of the label Sometimes when you look at a question, you may say: What method is this question? I will only search violently, and some are indeed search pruning...

image-20211018151027583

In addition to the label, also data range ! Data within the data range may appear, and different data ranges may be used in different ways (this is a lot of questions, and some questions use hashing and in-situ replacement have requirements for data).

If you look at the label and think about inspiration, it's best. If you still don't have inspiration, click on the solution. You can see if you can get inspiration from the label title. Many of the solutions will give enough hints. Some people can understand it when they see it.

img

If you still don’t know how to do it, just go in and look at other people’s ideas. Some are videos and some are pictures and texts. Until you understand them, if you still don’t understand them, either ask for leave or give up!

Write code and test

Don't have any reference to the process of writing code! Don't have any reference to the process of writing code! The important words are said twice. You can see your ideas and other people's codes. Don’t refer to and ctrl c + ctrl v when you write your own code. If the project can run, the efficiency is the cv method, but the interview written test questions basically require you. Closed-book, some even require you to use an online IDE even the prompts are not complete.

Common problems are often considered when writing code: test data boundaries (such as Integer.MAX_VALUE , Integer.MIN_VALUE ), loop control boundary processing, end data processing (sometimes forgotten to deal with), consideration of special abnormal conditions, whether the value range is reasonable, and algorithm Whether the complexity can be run out, the data depth is copied, the repeated traversal and operation are simplified, the variable naming is clear, and the comments are relatively complete...

After writing the code, use the test case to test more to ensure that it is foolproof. Likou often produces null value test cases, because this wa has been used many times...

If there is a problem that is different from what you imagined, first look at your own code logic to see if you can see the problem. If you can see it is just right, if you can’t see it, then print it out or debug to find the problem until you correct it. There are many Questions need to consider a more comprehensive ability ac.

Method and result comparison

Don't think that ac is over. You have to see how many people you have surpassed in time. It is recommended to measure your code from these two dimensions:

More than 70% of the people (appropriately improve according to your own requirements): Most of the questions exceed 70%, indicating that your method is okay, and there may be some minor aspects that can be optimized. For example, StringBuilder replaces String for string splicing, and uses char[] array to replace String for traversal enumeration and so on.

Your own method is within the time range of a good method: some questions are relatively difficult, everyone is the fastest method. Your code may be 1ms worse than others, which is very slow. At this time, you only need to make sure that your method is excellent. 100%, and the time spent in different evaluations Ji's results may be different. You can look at everyone's time spending range. If your method is within a few milliseconds or 30% of the time with the fastest method, it is actually ok. If someone else’s 4ms is 4ms, you’re okay with 5ms, if someone else’s is 50ms, you’re okay with 70ms, but if someone else’s 80ms is too much worse than your 800ms, you have to look at your own logic and code.

image-20211018155617921

In addition, if you click on the histogram of the previous time, you can see other people's less time-consuming code (some of them may not run so quickly because of the change of test data). You can refer to other people's processing methods.

image-20211018160012025

Consolidation and improvement

After this problem, you can see if there is a more clever way to deal with the difference between the problem solutions. When you have a direct comparison with others after ac, you will be more impressed: it can be like this!

If you feel that you don’t have a solid grasp of this type of question and want to practice it again, you can look at similar question types to consolidate it in time.

Concluding remarks

Some of the above methods are limited to suggestions for some beginners, not necessarily very accurate and efficient. You can refer to them. If the above questions are almost free, the recommendation can be followed by a daily check-in, half a year is 180+ questions, and a year is 365 The amount of questions is quite objective!

The first original public bigsai , welcome to pay attention and make progress together!


bigsai
695 声望12.2k 粉丝