With the beginning of spring recruitment in major companies, many partners are taking action. I am honored to join Baidu and share my experience with you. Since I was interviewed by large companies, I also prepared for this aspect, so this summary is not necessarily suitable for students who want to go to start-up companies. In addition, since experience is a highly subjective thing, and the author’s level is limited, so if there is a point of disapproval, I hope you laugh and forget.

Here, I’ll venture to share what I learned in preparing for and going to the interview, my thoughts on the interview, and some tips that might be useful to you. A gift package is included to help each reader find his or her dream job.







What is an interview

Some people may take the interview too seriously, think that after the interview, you can enter the big factory, technology and wealth……

In my opinion, a job interview is less dramatic (sorry for the headlines), but it’s a great opportunity for you and the interviewer to get to know each other and get a taste of what the job might be like.

The interview itself is not a complete evaluation of a person’s ability. Those who pass the interview may just happen to meet familiar questions in the interview, or fail the interview may be the fault of the interviewer himself. Not every interviewer has the ability to objectively evaluate others.

In other words, failing the interview may mean the interviewer didn’t see your talent, and passing the interview doesn’t mean you’re qualified for the job, because you’re not responsible for answering interview questions every day!

So in that sense, an interview is a bit like a blind date. You are satisfied with me, I am satisfied with you, bastard to mung bean — see eye, that hit it off, otherwise part company. I would love to have more interviews (it doesn’t always happen) so everyone has enough time to get to know each other and decide whether to stay or not.

In some online interviews, some methods of “pretending to be forced” and so-called “interview skills” are introduced, which I do not quite agree with. There is a technique that allows you to present yourself better, rather than cheat, make trouble out of nothing. I want to show my true self. If the interviewer doesn’t agree with me, it means that we have no fate or my ability is not enough.

What should I prepare for the interview

After ali was rejected for an interview, the interviewer offered this comment: “… I lack basic computer skills and basic programming skills…” . But this kind of general answer is not the answer we hope for, what does the so-called basis mean?

As an iOS developer, the fundamentals I understand are the operating system, the network, and the algorithm. Different development directions may have different focuses, but the fundamentals are basically the same. I don’t recommend going to an online tutorial to learn the basics, because there are no basics that can be explained in a few short articles, at least not one that I’ve seen written in such depth and simplicity.

I do not know how many readers and I have the same trouble: “I know something is very important, so go to Baidu to check the information, but the quality of the article is very poor, the accuracy is not guaranteed”. In fact, it is normal that excellent articles are generally placed on the personal blogs of excellent authors, which is exactly the blind spot of search engines, so generally only CSDN, blog park and other places to search for articles. Naturally, the quality of the article cannot be guaranteed.

With that in mind, I’ve included in the review material at the end of this article books for learning the basics and, if you happen to be an iOS developer, some of the high quality articles I’ve collected are guaranteed to be correct (except for ones I’ve written).

In addition to preparing general knowledge, the resume is also an important part. I have always admired tang Qiao’s ape test bank, but my resume is so bad that I didn’t receive an interview invitation. After a thorough revision of the resume, there is no such problem. As for resume writing, I recommend two articles: how to write a resume for Internet companies, and a resume template for apps. You can also refer to my resume, if there is no bright spot, just throw out a brick.

Finally, of course, it is to prepare the basic knowledge of relevant posts. As an iOS developer, even though Swift has been around for almost two years, there is not much movement from big companies to Swift, so Objective-C is almost a must, and Swift is not necessarily a plus. Knowledge of iOS is also essential. Although the job Posting says that if you have a solid foundation, zero iOS foundation is ok, but the reality is often cruel.

My interview experience

So much, finally get to the point, share my interview experience. The problem is as follows, and a simple solution follows the broken line.

baidu

One side: about 1.5 hours

First, there are four algorithms:

  1. How do you implement swap(a, b) without temporary variables — add or xor or both
  2. Find a number in a two-dimensional ordered array
  3. Search for the top ten logins in a hundred million log — hash the logins and ids first, and then the top ten in a red-black tree. 30
  4. A brief description of the sorting algorithm — fast sorting,partionFunction principle, heap arrangement (unstable), merge sort, radix sort.

Then there is an intelligence question, not a complete answer, as if the impact is not very big.

The last one is about iOS. The interviewer asked very open questions about his own understanding:

  1. Tell me about your interest in OCloadMethods andinitializeSimilarities and differences of methods. Will methods that do not implement subclasses call their parent classes?
  2. Tell me what you understand about block. — Three types of blocks, automatic copy on the stack to the heap, block property modifier is copy, circular reference principle and solution.
  3. Tell me what you understand about runtime. How to find a method when it is called, how to forward a method when it is not found, and the memory layout of an object.
  4. Talk about your understanding of MVC and MVVM. MVC C is too bloated, it can be merged with V to become the V in MVVM, which is used to convert M into data that V can use.
  5. Talk about tuning UITableView. One is to check with Instruments where performance is affected, and the other is to estimate the height and cache it when runloop is idle.
  6. Talk about your understanding of ARC. ARC is done by the compiler, relying on reference counting, talking about memory management strategies for several attribute modifiers, and when memory leaks occur.

The questions on one side are very basic, mainly algorithms and Objective-C, and because I’m prepared, I should probably answer 80% of the questions. About a week later, they had a second interview.

Second interview: about 0.5 hours

The second interview was more abrupt, showing a simple self-introduction and then asking three questions:

  1. What are wild Pointers, and when do they happen in iOS development? A pointer is a pointer to memory that has been freed but is not nil.
  2. Introduction to block. I asked the interviewer to give me a hint as to when a wild pointer will occur. When he said block, I said I still don’t know, only that block will have a circular reference. So it goes back to one side of the problem.
  3. Talk about how you optimized UITableView. – It is still a question of one side…

Although I passed, I almost asked the same question again, which made me feel that the other party was not serious.

Three ways: Beijing Onsite, about 2.5 hours

The first one is an hour, handwriting algorithm two algorithm problems. Next I asked about the TCP handshake. Finally asked some details about OC.

netease

The written test

It’s a hodgepodge of computing, operating systems, networks, mobile development, algorithms, etc. Difficulty is not difficult, visual detection is in order to eliminate the people in troubled waters, will not list the topic, the algorithm has three questions, directly online write (no IDE said very sad) :

  1. It took me a long time to understand the problem. It seemed to be DFS, but at last I ran out of time and wrote an idea.
  2. Change the string like “www.zhidao.baidu.com” to “com/baidu/zhidao/ WWW “. Offer = offer = offer = offer = offer
  3. Find all subarrays neutralized by a value, such as the array is,5,10,2,3 [5]There are four subarrays whose sum is 15, for example[5, 10].[5, 10].[10, 2, 3].,5,2,3 [5]. So this is a simple recursion, and there are two cases where the number is in the subarray, and the number is not in the subarray.

One side

All iOS questions, probably feel that the algorithm has been met:

  1. Introduction to block. — I mentioned that blocks on the stack are automatically copied to the heap under ARC. The interviewer asked me whether iOS 4 or 5 will support this feature. I didn’t know, I didn’t study OC history, but later I thought it might be an old project in the company.
  2. What optimizations will ARC make to the code? , such asNSString *s2 = s1; s2 = nilSuch a statement might not existretain ε’Œ releaseMethods.
  3. Introduce MVVM and RAC. — Maybe I used RAC in a corner of my resume, but it was dug out. After talking about it, the interviewer asked me how to make two-way data binding.bindπŸ˜‚πŸ˜‚πŸ˜‚
  4. Describe which open source libraries you have used. — Navigation and SnapKit, AFNetWorking, MKNetworkKit, Alamofire, Mantle, SDWebImage
  5. Could you do it if you wrote it? — Of course not, or an internship?
  6. Have you read the source code for a library? — A bit about SDWebImage, later I was told that this library uses runloop to ensure the smooth loading of data by sliding. After reading the source code, I didn’t find it. The only place where runloop is used is to keep the background thread running.
  7. Why does SDWebImage need to decode the image after it has been downloaded? — At that time, the interviewer was very nice to explain, said that the PNG file to create a memory map, I do not understand, have time to study.

Originally thought the surface so bad affirmation is hung up, did not think or over one side. Less than an hour later, HR called and made an appointment to meet again two days later.

Second interview

Pure mathematics and algorithms:

  1. The output of this code is:

    Int main() {int a[5]={1,2,3,4,5}; int *ptr=(int *)(&a+1); Printf (" % d, % d ", * (a + 1), * (PTR - 1)); }Copy the code

    The answer is 2 and 5. A is the pointer to the beginning element of the array, and a + 1 is the pointer to the next element, so the asterisk evaluates to 2. Ampersand a is a pointer to an array, and ampersand a plus 1 is a pointer to an array at the end of the array, and then converted to int star is a pointer to a number at the end of the number 5. Minus one is a pointer to 5, so the asterisk evaluates to 5.

  2. If it doesn’t rain on the first and second days, there’s a 30% chance it will rain on the third. If it rains on either day, there is a 60% chance of rain on the third. If it didn’t rain on Monday or Tuesday, then the probability of rain on Thursday is _.

    Simple probability, the answer is: 30% * 60% + 70% * 30% = 39%

  3. A small group of poker addicts like to count with 23456789TJQKA, an A followed by 22,23… ,2A,32,… ,AA,222,… And so on. Write a program in C/C++ or Java that converts the string representation into a string representation of a decimal integer. Where, 2 in this notation corresponds to 2 in decimal notation, increasing successively. Char pokToDec(char)

    My solution is to convert to base, something like hexadecimal to base 10, and finally convert the number to char *.

And then there seems to be no results, maybe the programming implementation is too bad?

Other interview questions I know

Ali side:

  1. MVCWhat are the advantages? How do modules communicate with each other? For example, how to notify Model after clicking Button?
  2. Two lists of infinite length (which may have rings) determine whether they intersect
  3. UITableViewCorrelation optimization of
  4. KVO,Notification,delegatePros and cons, efficiency and usage scenarios
  5. How to Manually NotifyKVO
  6. Objective – in Ccopymethods
  7. The runtime,SEL ε’Œ IMPThe difference between
  8. autoreleasepoolThe application scenarios and principles of
  9. RunLoopWhen will it be used
  10. blockWhy circular references
  11. useGCDHow to implement this requirement: Perform tasks A, B, and C concurrently and execute task D after completion.
  12. NSOperation ε’Œ GCDThe difference between
  13. CoreDataHow to handle multithreading problems
  14. How to design image cache?
  15. Have you ever designed web controls yourself?

Second face of Ali:

  1. How do you judge someonecellWhether it is displayed on the screen
  2. The difference between processes and threads
  3. TCP 与 UDPThe difference between
  4. TCPFlow control
  5. The difference between arrays and linked lists
  6. UIViewThe life cycle
  7. If page A goes to page B, A’sviewDidDisappearMethod and BviewDidAppearMethod which is called first?
  8. blockCircular reference problem
  9. ARCThe nature of
  10. RunLoopHow does it sleep?
  11. AutoreleasepoolWhen will it be released and in what scenarios?
  12. How do I find the first non-repeating character in a string
  13. How does a hash table handle conflicts

The interview to harvest

1. How to answer the algorithm question

The interviewer might ask you about an algorithm you’ve never heard of, so instead of thinking about it, you should discuss it with the interviewer first. We should know that it is also a kind of ability to understand complex problems through communication. In the process of communicating with the interviewer, we can not only find out what the real meaning of the questions is, but also show our good communication skills. So don’t waste a great opportunity just because you’re nervous or shy.

Some of the topics are familiar, but I have no idea for the time being. At this point, I might as well tell the interviewer and give me some time to think about the problem. Then don’t worry, don’t panic, pretend he doesn’t exist, take out a pen and paper to do the math (this fully illustrates the importance of wearing headphones during the interview). You must firmly believe that “any algorithm that is even slightly difficult must take time to think about unless it has been done”. So, plan your thinking time wisely. If you can’t figure it out for more than ten minutes, you can just give up.

Sometimes an interviewer will ask you to program online, and trust me, he won’t be bored enough to stare at your code. Interviewers are usually busy and have their own work to do, so use your IDE. Online programming tends to be a medium difficulty problem, so don’t scare yourself. Also pay attention to the code format, appropriate comments, written test cases in advance, if not solve the problem, at least to show the interviewer that you have good programming habits.

2. How to deal with problems that you don’t know

This question could be a deliberate attempt by the interviewer to mumble in order to gauge your ability to communicate, it could be an unintentional attempt, or you could be misinterpreting. Either way, you should talk to the interviewer until you understand what the interviewer is asking you, rather than just saying a bunch of useless things as you understand them.

For example, an interviewer might ask an algorithmic question: “How do I know if two lists of infinite length intersect?” . “Infinite length” can be interpreted in different ways, and if there really are infinitely many nodes, then obviously the problem is unsolvable. But if the list is just rings, it can be solved. If the interviewer intended the list to have rings, but you misinterpreted it as an infinite number of nodes, you will inevitably fail to answer the question. And this is not a lack of ability, but a failure of communication, which is the “skill” I want to share.

There are also some questions that you may not have been exposed to, but you can reasonably assume because you have thought about similar problems or situations. For example, the interviewer asks, “What will ARC do to optimize the code?” . We know that the essence of ARC is to insert retain and release methods in the right place, so we should think about it from that perspective.

Obviously, it is not necessary to perform retain and release separately, so we can construct the corresponding example:

NSString *s1 = @"hello";
NSString *s2 = s1;
NSString *s2 = nil;Copy the code

Since we haven’t really practiced this kind of question, we can politely tell the interviewer, “Based on my reasoning, there could be…” .

3. How to deal with problems you really don’t know

Admit it when you don’t know it. If it’s a basic question, like how to implement a hash table, and you say no, then the interview may be up in the air. If it is a difficult question, it is wise for you to admit that you won’t. After all, no one is perfect, and a question can’t completely negate a person’s ability.

But one of the worst things that can happen is that a nervous candidate, worried about the consequences of not being able to answer the interviewer’s questions, tries to play along. For example: “I guess it’s XXX”, “I think it’s probably…” “, there are even direct installation force: “THIS I tried, is not XXX yao”. Want to know, at this time you, because of nervous, in the mentality has lost to the interviewer, what’s more, the interviewer asked you the question must be he is sure of, you think at this time you resist how much chance of success?

So, when the interviewer asked me for the details of heap sorting, I simply told him THAT I couldn’t remember how heap sorting worked. Another example of throwing in the towel was when the interviewer asked me how to implement two-way binding in RAC. I told him that this was a demo I had written when I was studying in RAC, and since it was not often used, I could only remember some simple concepts.

Finally, you need to maintain a steady state of mind: “Just do your best in the interview, and it’s normal to meet questions you don’t know.” If the interviewer answers all the questions correctly, it will inevitably make the interviewer feel a little awkward, and other emotions may also arise. So, what we need to do is to show our abilities to the interviewer without arrogance or impetuousness.

4. Prepare the killer card

In addition to being able to answer the interviewer’s questions, I recommend preparing a killer topic or two. The so-called killer’s mace has at least the following characteristics:

  • You tried it yourself. Practice is the sole criterion for testing truth, and data do not lie.
  • The problem has enough depth. The first interview may be with your immediate supervisor, and the second interview is usually for a change of rank. Your depth must be far more than other interviewers, so that one side of the interviewer feel that he is not fully grasp, so that the second interview that this is a good topic, their own men are not necessarily able to have such a unique and profound insight.
  • Your understanding of the problem is deep enough to reach a level of breadth and depth.

Take tuning UITableView in iOS, for example, which I think I know a bit about. For fellow iOS developers, read this article: UIKit performance tuning, while I also carefully studied sunnyxx optimize UITableViewCell high computation those things.

This kind of topic usually requires a careful study of the official documentation, and iOS developers can also watch WWDC videos and spend plenty of time summarizing them. For example, it took me at least three days to write this article on iOS custom transition animation, including the whole day on the first day of Chinese New Year.

There are only a few of these topics, so you can prepare one or more. You can consciously lead the interviewer to these topics during the interview, so as to fully demonstrate yourself.

5. State of mind

Usually, the result of the interview will be known within one to three days. Some interviewers will tell you a pass on the spot, while others will tell you a pass a few hours after the interview.

But sometimes, for some reason (I don’t know… Maybe you’re busy? You are not getting the results of your interview. In this case, you can choose to wait patiently and send an email to HR or the internal promoter directly. Usually you don’t get an email for three days after the interview, so you can send an email or wait.

Review the information

For those of you who are reading this, thank you for listening to me for so long, I send you a wave of carefully curated dry goods and materials. I can’t say there’s nothing wrong with it, but it’s a lot more reliable than looking it up on your own. It mainly involves five aspects: algorithm, network, operating system, Objective-C and iOS. If you’re not an iOS developer, the first three sections will help you.

algorithm

This section is divided into the following sections: strings, arrays and lookups, linked lists, trees, and other basic issues.

In general, algorithm problems can be divided into the following three categories:

  1. Basic issues: Even for novices, there are ideas in the past, but the implementation needs to pay attention to the details.
  2. Common questions: These questions usually fall into one of the above categories and require the interviewer to master some common ideas, such as recursion, dynamic programming, BFS/DFS, two-pointer, binary search, etc. Or directly examine the use of data structures, such as hashes, stacks and queues, linked lists, etc., if you have these basic knowledge, such problems can be relatively quickly solved.
  3. Advanced questions: The solution of these questions is similar to ordinary questions, but you need to have the corresponding knowledge accumulation in advance, otherwise it is difficult to see the essence of the problem directly.
  4. Difficult problems: this kind of problem is strange, after solving it can not give too much help to other problems, if time is tight can give up temporarily.

Generally speaking, a kind of problem is not difficult, simple review before the interview, careful interview, comprehensive thinking can be. Second three types of questions are the focus of the interview, need to prepare in advance. The fourth type of questions usually occur less frequently, and even if they are not done, the negative impact on the final evaluation is not as great as the first three types.

If time is sufficient, I suggest reading the book “Sword Finger Offer” and cooperating with Leetcode to consolidate knowledge. In my interview, there were many original questions or variations in the book, and I don’t think any interview score was affected by the algorithm. If you’re pressed for time, you can also just complete some of the classic questions I’ve listed, marking my classification of this type of question in “[]”, and asterisking it to indicate that it actually came up in the interview.

PS: Recently some friends were asked about the implementation of hash tables. This can be understood as algorithms, or it can be classified as computer basics. In general, you need to understand at least the characteristics of hashing and the two ways to resolve conflicts: pulled and open addressing.

string

  1. [3] The longest callback substring
  2. [3] Longest non-repeating substring
  3. [1*] The string is converted to a number
  4. [4] KMP algorithm
  5. [2] All strings are arranged
  6. [2*] Reverses the string

Dynamic programming

  1. [2] Backpack problem
  2. [3] Maximum sum of continuous subarrays
  3. [4] To achieve simple regular expression matching

Understand the following sort of time, space complexity, whether stable, implementation principle

  1. Merge sort and expand: Find the number of inversions in an array
  2. Quick sortKey points:partionFunction implementation
  3. Heap sort
  4. When the range of array elements is known, radix sort and bucket sort are considered

An operation

The network layer

The emphasis varies slightly depending on the position you are interviewing for. For iOS and Android developers, HTTP is slightly less important, with TCP and UDP predominating. In fact, UDP basically only looks at the difference between TCP and UDP.

Of course, there are some common basic questions, such as Cookie and Session, POST and GET, a simple understanding of HTTPS, etc. These issues are briefly summarized in my blog.

Summarized some information, the number of the larger the information is longer, time-consuming, more difficult, explain more detailed. A broken line indicates how long it will take to finish reading.

It’s no use just reading books. It’s easy to get confused when asked practical questions. Here are some of the questions I’ve summarized:

  1. Introduce the differences between TCP and UDP. At which layer are they located?
  2. How do routers and switches work, what protocols do they use, and on what layer are they located?
  3. Describes the process of TCP three-way handshake and four-way release.
  4. How does TCP implement traffic control and congestion control?
  5. Why three handshakes to establish a connection, two is ok? What happens if the third handshake fails
  6. What do I do if the fourth handshake fails when I close the connection?
  7. How do you understand layering and protocol?
  8. The difference between GET and POST in HTTP requests, the difference between Session and Cookie.
  9. Talk about your understanding of HTTP 1.1, 2.0 and HTTPS.

Operating system and compilation

I was asked very few operating system questions, so I just summarized the ones I thought were important. For this section, I recommend reading Programmer Self-Cultivation. If time is limited, you can read my Programmer Self-Cultivation Book Notes and ask these questions:

  1. How does source code become an executable, and what does each step do? (Precompilation, lexical analysis, syntax analysis, semantic analysis, intermediate language generation, object code generation, assembly, linking)
  2. What are the relationships among application layer, API, runtime, system call, and operating system kernel?
  3. What a virtual memory space is and why it is there.
  4. What are static link and dynamic link respectively, and how are they implemented?
  5. What is the structure of the executable? (What are the sections?)
  6. How is it loaded into memory, why is it segmented, paginated, what are the page errors?
  7. What is the memory pattern of the process? (Heap, stack, global/static area, code area, constant area)
  8. The difference between heap and stack, function call and stack
  9. The difference between processes and threads
  10. The difference between asynchronous and synchronous, serial, concurrent, and parallel
  11. Multiple concurrent tasks, can multithreading alone speed things up (no, it will be slow, with thread switching overhead)
  12. That data can be shared between multiple threads
  13. How do processes communicate with each other
  14. Introduce several locks, their uses and differences

For more information about multithreading, I recommend reading the previous section of this article, “iOS Multithreaded Programming — GCD and NSOperation Summary.”

For an article on operating systems and compilation, in addition to reading the original book and my reading notes, you can also refer to this article, “Modifying a Digital Hack Application on Mac.”

OC

The first two essential books of the Gods must be read. One is Effective Objective-C 2.0, which is called “52 Effective Ways to Write High Quality iOS and OS X Code”. Another book is called Advanced Programming in Objective-C. The former covers the details of OC, while the latter focuses on ARC, blocks, and GCD.

It’s easy to get stuck in an interview if you don’t do enough reading and thinking, so try to answer the interview questions again while reading the following summary passage, in no particular order of importance:

I strongly recommend the eighth article, the above topics can basically deal with most OC problems.

The iOS development

It needs to be emphasizedrunloop, it is not just a simple concept of “running laps”, many problems are actually related to it, it is recommended to read the summary of Ibireme god carefully

Other side by

  1. How did I get the offer from Both Ali and Tencent
  2. The junior student got the internship offer of Ali and Baidu and shared the interview experience
  3. January 2016 TX electrical questions