It can be seen from the situation of autumn recruitment in 2011 that Internet companies have higher and higher requirements for friends with technical skills, especially in code ability. More and more companies begin to examine the easy and medium questions of LeetCode in the interview, and the excellent students will also be examined at the hard level.

There is also a story about a programmer who went to his father-in-law’s house for the first time. Before dinner, his father-in-law gave out a LeetCode medium and started to use chopsticks after making it.

Whether it is the so-called “cold winter” factor of the Internet, or the recruitment requirements of enterprises rising tide, programmers have put forward higher requirements on data structure and algorithm, this article and we discuss the topic of brushing.

  • Why should I brush?
  • What does brushing mean?
  • What skills do you have when you brush questions?

First, why should brush the question?

Many people will think that the method of brushing questions like LeetCode seems meaningless and is just a kind of assessment method similar to eight points, but in fact, by brushing questions, you can have a better grasp of the basic knowledge of many computers.

I have talked with some interviewers about this topic before. They pay more attention to students’ basic knowledge and potential (intelligence level) than other abilities, so coding has become an important means to evaluate students’ ability.

By brushing questions, we can first have a better understanding of the basic data structure.

If you have a good command of these in your college courses, you can start to brush the questions directly, whereas if you are not familiar with these, you might as well try some reputable online courses and go through the basics quickly, which may be better than starting to brush the questions directly.

The following three parts quote Edward Shi, a zhihu blogger, about what basis is needed to brush Leetcode? Answer (abridged) :

1.1 Data Structure

Array, linked list, stack, queue, tree, graph, heap, HashTable, line tree, tree array, and lookup set, dictionary tree, etc

1.2 algorithm

Sorting algorithm (eight kinds), DFS, BFS, binary search, backtracking, divide and conquer, recursion, dynamic programming, topology sorting, greedy algorithm (school can not learn) : Sliding window, scan line algorithm (graphics), reservoir algorithm, flood fill (graphics), etc

The more difficult ones involve many: KMP, horse-drawn carts, etc

1.3 Other Knowledge

Bit operation, basic data structure implementation (LinkedList Deque, etc.), some Design ideas (Design), Math knowledge (Math), wildcards, escape characters, memorized search, etc. If you’re using Java, and other languages as well, Java also has some common data structures: TreeMap, TreeSet, PriorityQueue, Deque, etc

It can be seen that the topics only involved in LeetCode cover a wide range and can be used to comprehensively inspect candidates.

Two, how to brush the question?

How to brush? How many brushes per day? Brush what difficulty? In what order?

This question is very common, my advice is:

2.1 Brush the question according to Topics

Such as linked lists, arrays, dynamic programming, and so on

2.2 Set aside regular time

I can’t say there’s anything wrong with this, but it doesn’t seem very desirable to me — in fact, most people aren’t nearly that busy.

Giving up something less important like entertainment and doing something planned for a fixed time each day is much more effective than some time-saving philosophy.

2.3 If you can’t write, look at the answer

Some friends are frustrated because they can’t write, and finally give up to brush, which is not a very good choice. When you are sure that there is no train of thought, boldly look at the answer, as long as you can understand the answer, it is OK to review later. A lot of times, some problems don’t work, not because of their own problems, but because some problems just have a certain pattern (as mentioned before, there are many such algorithms), so it’s not necessary to spend too much time on these problems.

The premise of looking directly at the answers is to review the previous questions often to see if there are any ideas.

Write the topic feel more complex when thinking, might as well take paper and pen to see.

2.4 Constantly reduce time and space complexity

There are many different solutions for many problems. Try to find the best solution for each problem. If you don’t get it right, mark will review it next time.

The interviewer will also guide you step by step during the interview to choose the best algorithm, and the best algorithm for a particular situation.

Three, what are the brush tips?

3.1 The most important “skill” : persistence

MAO Zedong had modified a pair of couplets of self-encouragement: your constant, why the night sleep; The most useless, but a day ten cold exposure. Sticking to anything is the most important, so is brushing. No matter how rich the plans and theories are, it is difficult to execute them well without time to support them.

3.2 Write online, avoid ide

Writing directly is a lot more exercise, part of it is the ability to code, part of it is the code style, and a good code style makes people more willing to work with. For example, if you’re comfortable with Java, check out Ali’s coding specification, as well as others.

reference

  • What are the basics of leetcode?
  • Baidu Xiaomi 2018 intern interview
  • Kuaishou, Pinduoduo, Huawei, INDUSTRIAL and Commercial Bank of China, China Merchants Science and Technology, the fourth paradigm algorithm engineers
  • The recent plan