01Personal circumstances
I am not an undergraduate. I mainly studied specialized courses in my freshman and sophomore years, and then I found some materials related to back-end development after class (Bilibili has a lot of learning materials, and I am a kind of HHHHH). Then IN the second semester of my junior year, I got the back-end internship offers of CVTE, Kuaishou and Bytedance. Finally, I chose Shenzhen Bytecode, and then I got the formal offer.
Click on the[阅读 全 文]See the full article, better reading effect!
02The interview content,
(Note: there are many words in this section)
One side
1. Preorder traversal of binary tree
The recursive version
non-recursive
2. Continuous maximum sum
If an array has N elements (N>0), find the maximum sum of consecutive subarrays. For example: [-1,2,1], and the largest continuous subarray is [2,1], whose sum is 3.
If an array has N elements (N>0), find the maximum sum of consecutive subarrays. For example: [-1,2,1], and the largest continuous subarray is [2,1], whose sum is 3.
3. Party A and party B take turns to flip a fair coin. The one who flips heads first will win. What are the probabilities?
The person who flips the coin first has a 2/3 chance of winning, and the person who flips the coin last has a 1/3 chance of winning.
4.TCP four-way handshake? Can I do it three times? Why four times?
The four handshakes are as follows:
The four handshakes are as follows:
Cannot be combined into 3 times. Because TCP provides a full-duplex channel, sending a FIN from a client only means that the client has no data to transmit. But the server may still have data to transfer. Therefore, each pair of FIN and ACK closes the connection on one side.
5. Which phase of TCP is Timewait?
6. How to configure load balancing on Nginx?
Configure the forwarding address and forwarding policy in the upstream, and configure the upstream to which the request is forwarded in the location.
Configure the forwarding address and forwarding policy in the upstream, and configure the upstream to which the request is forwarded in the location.
7. How does Redis deploy a cluster? How does Redis Cluster work? How to load a Redis request to a specific node? (don’t)
No cluster has been deployed. There is an official Redis Cluster for deploying clusters. Consistent hashing is used to load Redis requests to nodes in the cluster.
No cluster has been deployed. There is an official Redis Cluster for deploying clusters. Consistent hashing is used to load Redis requests to nodes in the cluster.
8. How does Redis implement distributed lock? (Poor answer)
To achieve the official Redis RedLock, every time to obtain a distributed lock, to all Redis nodes issued setNx request lock, if more than N/2 node support, it indicates that the lock was obtained, otherwise to all Redis nodes issued a request to delete the previous Settings of the key.
To achieve the official Redis RedLock, every time to obtain a distributed lock, to all Redis nodes issued setNx request lock, if more than N/2 node support, it indicates that the lock was obtained, otherwise to all Redis nodes issued a request to delete the previous Settings of the key.
Second interview
1. Differences between HashTable, HashMap, and TreeMap
HashTable is thread-safe, HashMap is not thread-safe. HashTable uses synchronized as a keyword, so concurrency performance is poor.
TreeMap supports sorting, ascending by default, and keys cannot be null.
HashTable is thread-safe, HashMap is not thread-safe. HashTable uses synchronized as a keyword, so concurrency performance is poor.
TreeMap supports sorting, ascending by default, and keys cannot be null.
2. The New generation, the old generation? Why is there an old age?
New generation, old generation is the concept of Hotspot VIRTUAL machine. Because according to some statistics, most objects have a short life cycle and become junk soon after they are created.
Therefore, in general (except for large objects), new objects are created in the new generation, and only objects that have not been collected after a certain number of gc sessions can enter the old generation.
By default, new generation: old is 1:4.
Subjectively, we believe that objects that have not been collected after a certain number of GCS are less likely to be gc (not impossible).
We can imagine that if there were no old generations but only new generations, then every GC would scan the entire memory, which would increase the stop the world time.
On the other hand, by dividing the old age, the area of each GC can be limited to the new generation, which is much smaller than the entire memory scan scope.
Of course, in this way, garbage objects will appear at some point in the old age, but it does not matter, because the old age as long as there is no space shortage, it does not affect the use.
When the old age also runs out of space, the old age is gc, and then the garbage objects are collected.
Summary: Narrow the scope of GC (MinorGC to be exact), reduce stop the world time, improve throughput.
New generation, old generation is the concept of Hotspot VIRTUAL machine. Because according to some statistics, most objects have a short life cycle and become junk soon after they are created.
Therefore, in general (except for large objects), new objects are created in the new generation, and only objects that have not been collected after a certain number of gc sessions can enter the old generation.
By default, new generation: old is 1:4.
Subjectively, we believe that objects that have not been collected after a certain number of GCS are less likely to be gc (not impossible).
We can imagine that if there were no old generations but only new generations, then every GC would scan the entire memory, which would increase the stop the world time.
On the other hand, by dividing the old age, the area of each GC can be limited to the new generation, which is much smaller than the entire memory scan scope.
Of course, in this way, garbage objects will appear at some point in the old age, but it does not matter, because the old age as long as there is no space shortage, it does not affect the use.
When the old age also runs out of space, the old age is gc, and then the garbage objects are collected.
Summary: Narrow the scope of GC (MinorGC to be exact), reduce stop the world time, improve throughput.
3. How do YOU generate a reference?
-
The most common is new, where you create an object and then you assign the new object to a reference variable, which holds a strong reference to that object.
-
If you have a container and you put the new object in the container, then the container indirectly holds the object, so long as the container is not recycled, then the object will not be recycled.
4. How to tell if an object is garbage?
Starting from GCROOTS, objects that are traversed are marked as valid nodes, and objects that cannot be traversed are garbage.
There are several general types of GCROOTS:
Starting from GCROOTS, objects that are traversed are marked as valid nodes, and objects that cannot be traversed are garbage.
There are several general types of GCROOTS:
-
Objects in a stack frame
-
A static variable
-
A constant reference object in a method area
-
JNI reference objects in the local method stack
5. After entering the URL in the browser, the DNS process occurs.
-
The browser searches its own DNS cache, the OPERATING system’s DNS cache, and the local host file. If none exists, query the DNS server.
(Feel a little easy to say, and the interviewer incidentally about DNS pollution)
The “Great Firewall” of China is the use of DNS contamination to resolve the IP address corresponding to the domain name of some foreign websites (such as Google) in the DNS server to a wrong address, so that they cannot be accessed.
6. What is the difference between a process and a thread? How do processes communicate?
In an operating system, a process owns resources and acts as the unit of scheduling, but once threads appear, the process only owns resources and uses threads as the basic unit of scheduling.
Process communication mode:
-
signal
-
The pipe
-
The message queue
-
The Shared memory
7. The sum of single linked lists, using single linked lists to represent a number: 1->2 (12), 3->4 (34), the sum of the result is 4->6 (46).
Idea 1: Use a stack implementation
Idea 2: The time complexity is O (N*logN) and the space complexity is O (1).
-
Add all the digits in the corresponding bit to the long list (no matter the number of nodes exceeds 10 or less);
-
Set the flag bit to false to traverse long lists.
-
If the value of the node is greater than or equal to 10, take the value of val module 10 and carry the preceding node, setting the flag to true. If the value of the node is less than 10, no operation is performed.
-
Since the previous bit may be more than 10 in the round (for example, if the previous bit is 9, if you give it 1, it will be 10), as long as the flag is true, the loop will continue until the flag is false after one loop.
On three sides
1. Junior or senior year?
Junior year.
Junior year.
2. Graduation job or postgraduate entrance exam? Why is that?
Work. Because I like computer, I also like hands-on practice.
Work. Because I like computer, I also like hands-on practice.
3. What are you studying recently? How do you study?
Recently I am learning Golang and reading the great Guy Xu’s book.
Daily study:
Recently I am learning Golang and reading the great Guy Xu’s book.
Daily study:
-
Learn some concepts through some articles
-
For more information, visit the official website
-
Get started quickly with some videos
-
Systematic learning through books
-
Return to official documentation
Given two numbers n and k, n represents the number of bottles you want to drink and k represents the number of bottles you want to buy.
Version 1: Backtracking, O (N) time complexity, O (N) space complexity (because recursive calls use stack space).
Version 1: Backtracking, O (N) time complexity, O (N) space complexity (because recursive calls use stack space).
Version 2: Dynamic programming, time complexity O (N), space complexity O (N).
Version 3: Dynamic programming, time complexity O (N), space complexity O (1).
5. Do you have any questions?
Q: do I have a one-to-one tutor if I go to byte?
A :(interviewer) yes, I should say every company has one for new employees.
Q: Which city is the department currently located in? I heard on niuke that the position in Shenzhen is full, will I be transferred to Beijing or Guangzhou?
A :(interviewer) the department is in shenzhen and there is no such situation as you mentioned.
Q :(I) toutiao mainly uses Golang and Python, do I need to switch tech stack?
A :(interviewer) I’m not switching tech stack. I just learned another language. As for MySQL, these are all general skills.
Q (Interviewer) : When can you start your internship?
A (me) : Maybe in July, to finish the course design and exams. But if you need to go early internship can also, after all, Guangzhou and Shenzhen quite close.
Q (interviewer) : It is suggested to come early. Toutiao needs 3 months of internship before going through the process of becoming a regular employee. If the talent is suitable, it will be much less pressure to go through the internal process of becoming a regular employee than the autumn recruitment. A (me) : Ok, I see. No more questions, thank you.
03The interview feeling
State of mind
I applied to more than 30 companies in spring recruitment, of which less than 10 can go to the written examination, and only 5 or 6 have the opportunity to interview, most of which are empty and their resumes are screened. It’s a very stressful time,
Be sure to hold your nerve and schedule a study plan, a written test and an interview.
Be sure to hold your nerve and schedule a study plan, a written test and an interview.
Technical interview
In terms of difficulty, since it is an intern interview, the requirements for the project are not particularly high and the content is not particularly difficult. The following strategies can be used to answer the questions:
-
For those who can, be able to
Correctly and logicallyAnswer in your own language, if you can answer the question, say something
extensionWhat will be
Bonus points; -
For the understanding, but do not understand the principle, you can think a little,
The assumption is how you’re going to do it, not necessarily right, but you have to have a rough idea of how you’re going to do it;
-
Example: Quick hand three interviewers asked
Working principle of the tail command -
Tail is the last few lines of the text (default is 5), so I just get the data, use the newline as the separator, and take the last few lines (similar to string split)
-
In the case of large text and limited memory, not all data can be read into memory, so file data should be read from back to front
-
When it comes to reading file data, that is I/O. As we all know, I/O is several orders of magnitude slower than memory operations. If you read too little data at a time, only one or two rows from the bottom, then you need to continue reading data, which requires multiple I/ OS. Therefore, a buffer of 1M (not necessarily 1M, but some other size, just a hypothetical value) can be used to read data of 1M at a time in memory to reduce the number of I/ OS
-
for
Never heard of, not at all, you should directly tell the interviewer that you are not familiar with the subject,
Avoid wasting both parties’ time, will also leave bad reviews; -
for
Algorithm questions, be sure to think clearly before coding, coding without sufficient thinking, there will be a lot of bugsThe interviewer can see your coding process.
HR side
They don’t brush peopleAs long as you have a sense of integrity and a sense of teamwork.
HR will usually ask:
-
Experience in school
-
Learning life
-
How to learn
-
How did you collaborate with other students if you had project experience
-
How are disagreements resolved and so on
Answer normally, then use more examples that show you in a positive light.
04
Resume writing
The space
Recommend two pagesOne page is generally too little (depending on the layout) and more than two pages is too much to sift through.
Personal information
-
Name, mobile phone, email, blog (if any), formal photo (no fancy ones), desired position, school, awards and certificates (if any);
-
Be sure to double check the information to make no mistakes.
Skill points
-
Don’t be too general, the interviewer is basically looking at your resume to ask, you use a few very general words to summarize the skills, the interviewer will not have to ask;
-
Counter example: “Familiar with MySQL”, “familiar with computer networks”
-
Examples: “Familiar with MySQL, index principle, SQL optimization, Innodb engine”, “familiar with common network protocols such as HTTP, TCP/IP”
-
Consider which of your skill points are “knowledgeable,” “familiar,” and “proficient.” Don’t assume that “proficient” is enough because you know how to use it.
-
Counterexample: “Proficient in the Java programming language”
-
Example: “Proficient in Java language, understand OOP ideas, understand Java8 Lambda expressions, Java9 modularity, etc.”
Experience in project
-
Project background;
-
Give a general idea of what the project will be about. Anything too detailed can be dictated during the interview. Don’t take up space on your resume
-
What functions are you responsible for;
-
Note: not the purpose of this feature, but what techniques did you use to design and implement this feature
-
What results have been achieved.
-
Performance, architecture, elegant code implementation, and more
05
Advice for children
preface
Time is precious, and choosing the right direction will make a better skill tree. This paper gives the general learning priority and the general learning direction for the basis, advancement, tools and ideas needed by the back-end daily.
(Note: The advice below may not be for everyone.)
Quick start development
This route is suitable for the students who are just beginning to back-end development, covering the knowledge needed for daily development, probably master the following skills, generally can try to do some small projects.
Considering that most of the students at this stage are still
A freshman.
In the choice of depth and breadth of knowledge, I think breadth is a higher priority, and we should broaden the breadth of knowledge and build knowledge system.So other skills are covered in the following mind maps, for example, although the studio uses Java as the development language, I will mention other languages in “Languages”.
A freshman.
In the choice of depth and breadth of knowledge, I think breadth is a higher priority, and we should broaden the breadth of knowledge and build knowledge system.So other skills are covered in the following mind maps, for example, although the studio uses Java as the development language, I will mention other languages in “Languages”.
(Note: this knowledge point must be mastered if it is marked with an *. If it is not marked with an *, it is regarded as an extension of knowledge and is not required.)
The advanced
This route is suitable for backend developers who are already able to complete their daily work.
Considering that most students at this stage are sophomores (about to be juniors) and will face job hunting in the second half or the first half of next year, therefore
In terms of the choice of depth and breadth of knowledge, I think depth is a higher priority. We should not only know what it is, but also know why.
In terms of the choice of depth and breadth of knowledge, I think depth is a higher priority. We should not only know what it is, but also know why.
digression
When I was a freshman and sophomore, I also had a lot of confusion in learning direction and took many detours. Now hope that some of their share, can let the latter less detours.