Whiteboard / Coding interview
The other day I read a wonderful text “I saw hack in the face” about a whiteboard interview (this is when they put a board in front of a candidate or put a piece of paper and say: “write such a program on the board”). In the article, everything is essentially correct, only a little in the style of the princess’s crying for lost youth, well, the main fools, of course, are the candidates. But I’ll tell you a secret: those who hire are also often fools, because the candidates themselves sooner or later find themselves in the position of those who hire, and stupidity does not go anywhere.
In fact, the stupidity of most candidates is illusory and stems from the fact that they do not understand the rules of the game very well, and on the other hand, they are not always honest. Let’s figure out how it is in life and how to deal with it.

To begin with, the interviewer, in fact, does not necessarily have a goal to hire. Sometimes he needs exactly the opposite, no matter how strange it sounds. This may be some kind of internal political game, or a desire to assert oneself: we will be honest, we programmers, because they are still snobs and know-it-alls.
Even if they want to take you, there may be a stubborn ram in front of you, who can even often conduct interviews, and maybe even do it for three or five years, but during that time he did not spend a minute to understand why why does he ask these questions? And, attention here! Why he counts only certain answers: not a step to the side and even up (in the style of: you complicate too much, I didn’t ask you that, etc.).
Until I myself began conducting technical interviews, it seemed to me that on the opposite side of the table were sitting not gods, but gods. In reality, in a large percentage of cases, the interviewer understands the issue worse than you - and this, by the way, is completely normal. The company holds him in the aggregate of various factors, and his goal is to measure you, and not measure your knowledge or something else.
Those. When coming to the interview, remember that if a person is interested in hiring you, he will not consciously bring you down, he will, on the contrary, find out (by the method of scientific poking) the depth and width of your knowledge. This person may not know something, not understand something or even make mistakes - this is also normal. It is important how much you can explain to each other: he - goals and objectives, you - your abilities and wishes.
This is a very important consideration. A good interviewer is trying to understand how you solve a problem. And he knows the right decision without you. Or he doesn’t know at all, but then the path that you walked to the decision is all the more important to him.
Here again about the rams. There are people who are waiting for the right answers from you. Well, what can I do? Tell a story from the life of St. Petersburg State University.
At the Physical Faculty of St. Petersburg State University, the most difficult subject was ... a military department. It was impossible to understand anything there, but it was only possible to memorize: it was impossible to change the notation of variables, all formulas were presented in the most complex form (and they could not be simplified), you had to forget about the integrals, about the ingenious course in radio physics, which you just read - especially. In a word - trouble, especially for those who really understood physics.
If you come to a person who wants to hear the correct answer from you, then you can’t do anything about it. Fighting and crushing intellect is useless. But then from such an interview one can extract indirect information about what is happening inside the company. Nothing good: drought and gloom.
Somehow I myself was in such a situation. They constantly poked me at Microsoft, although we talked about completely abstract things. Then it turned out that Microsoft had some kind of text, or a directive: “to all people with brain interpraise to walk and think along this line.”
By the way, this is the biggest disappointment and the biggest mistake that scares away strong candidates: if a person doesn’t know something, but offers to deduce, think up, talk about it - this is a find, but often the interviewer says “stop, I am not interested”, and puts a minus in a piece of paper. And the candidate is bored and depressed at this moment, because he understands that no ability to solve the company's problems is needed. And, believe me, this is simply not a feeling, most likely inside the company you really do not need to solve complex technical problems.

But still, what should a candidate do during a white board interview in order to pass him as well as possible? Here I proceed from the assumption that you came to a sane interviewer who does not want to overwhelm you (but this does not mean that he will save you).
If you are still filled up for an interview, then my advice is: write a nasty letter to these idiots that you are doing really complicated things, and since they tried to force you to write an algorithm on the board, they are looking for an encoder, and not such a serious person as you. After that, relax and go read the next muddy book about how to write xml-configs.
And my whole text, of course, does not negate the fact that you know everything about meat and bones: data structures and algorithms. But this is very easy to find on the Internet at the request of a hacking code interview. Otherwise, of course, my first paragraph (“Always say”) will only make you worse. Always learn!
In fact, the stupidity of most candidates is illusory and stems from the fact that they do not understand the rules of the game very well, and on the other hand, they are not always honest. Let’s figure out how it is in life and how to deal with it.

Who is in front of you?
To begin with, the interviewer, in fact, does not necessarily have a goal to hire. Sometimes he needs exactly the opposite, no matter how strange it sounds. This may be some kind of internal political game, or a desire to assert oneself: we will be honest, we programmers, because they are still snobs and know-it-alls.
Even if they want to take you, there may be a stubborn ram in front of you, who can even often conduct interviews, and maybe even do it for three or five years, but during that time he did not spend a minute to understand why why does he ask these questions? And, attention here! Why he counts only certain answers: not a step to the side and even up (in the style of: you complicate too much, I didn’t ask you that, etc.).
What are you talking about?
Until I myself began conducting technical interviews, it seemed to me that on the opposite side of the table were sitting not gods, but gods. In reality, in a large percentage of cases, the interviewer understands the issue worse than you - and this, by the way, is completely normal. The company holds him in the aggregate of various factors, and his goal is to measure you, and not measure your knowledge or something else.
Those. When coming to the interview, remember that if a person is interested in hiring you, he will not consciously bring you down, he will, on the contrary, find out (by the method of scientific poking) the depth and width of your knowledge. This person may not know something, not understand something or even make mistakes - this is also normal. It is important how much you can explain to each other: he - goals and objectives, you - your abilities and wishes.
This is a very important consideration. A good interviewer is trying to understand how you solve a problem. And he knows the right decision without you. Or he doesn’t know at all, but then the path that you walked to the decision is all the more important to him.
What is expected of you?
Here again about the rams. There are people who are waiting for the right answers from you. Well, what can I do? Tell a story from the life of St. Petersburg State University.
At the Physical Faculty of St. Petersburg State University, the most difficult subject was ... a military department. It was impossible to understand anything there, but it was only possible to memorize: it was impossible to change the notation of variables, all formulas were presented in the most complex form (and they could not be simplified), you had to forget about the integrals, about the ingenious course in radio physics, which you just read - especially. In a word - trouble, especially for those who really understood physics.
If you come to a person who wants to hear the correct answer from you, then you can’t do anything about it. Fighting and crushing intellect is useless. But then from such an interview one can extract indirect information about what is happening inside the company. Nothing good: drought and gloom.
Somehow I myself was in such a situation. They constantly poked me at Microsoft, although we talked about completely abstract things. Then it turned out that Microsoft had some kind of text, or a directive: “to all people with brain interpraise to walk and think along this line.”
By the way, this is the biggest disappointment and the biggest mistake that scares away strong candidates: if a person doesn’t know something, but offers to deduce, think up, talk about it - this is a find, but often the interviewer says “stop, I am not interested”, and puts a minus in a piece of paper. And the candidate is bored and depressed at this moment, because he understands that no ability to solve the company's problems is needed. And, believe me, this is simply not a feeling, most likely inside the company you really do not need to solve complex technical problems.

Technology
But still, what should a candidate do during a white board interview in order to pass him as well as possible? Here I proceed from the assumption that you came to a sane interviewer who does not want to overwhelm you (but this does not mean that he will save you).
- Always talk. Talk about what you think, what ideas you have. Explain the course of your thoughts. Not a single person can immediately give the correct answer, and your train of thought - in fact, this is the most indicative of you.
- To make mistakes is normal. Say calmly: “now I can see that I was mistaken” or “my decision was not perfect, let's see how it can be improved” or “yes, I suggested a bad option, let's offer another”.
Why : If you have been given a task that requires insight ( i.e. the worst possible of all possible tasks ), then, of course, no reasoning will help you. In all other cases, the interviewer is interested in exactly how you go to the decision.
- Start simple. Do not complicate the decision until you are asked. Remember how you program. Almost never do you write the whole solution, you come to it gradually: first one aspect, then another, then the third (and sometimes you even stop, because premature optimization is evil)
- Do not guess. Interviewers rarely want to confuse you. If you don’t know where to go, then just ask: with a high probability this question is expected from you. Such a question shows that you understand the area in breadth. And with a high probability the answer (assumption of data) will make your decision easier and more transparent.
- Forgot the name of the method? Not a problem. Nobody requires you to remember the names of the methods and their correct spelling. It is enough that you know that such and such functionality is easily taken from somewhere. To demand knowledge of the order of parameters at an interview (nowadays, when it’s even compliant in MS Word) is wildness.
- Do not be afraid. If it seems to you that they are trying to catch you on something, then with a high probability, your head is too complicated or foggy, and a simple and intelligible answer is expected from you. Answer simply by describing the limits of applicability. If they want to hear more from you, they will ask you (or they will not ask, because they will see that you already know what is beyond these borders).
- Forget about specific languages and frameworks. Most often, you are required to understand how things are done inside. If you are asked how the HTTP protocol works, then you don’t need to tell how to make an http call from Java / C # / Python or your favorite language. Tell us what DNS, TCP, keep-alive, headers and request body are (and why HTTP / 2.0 is a pain).
If you are still filled up for an interview, then my advice is: write a nasty letter to these idiots that you are doing really complicated things, and since they tried to force you to write an algorithm on the board, they are looking for an encoder, and not such a serious person as you. After that, relax and go read the next muddy book about how to write xml-configs.
And my whole text, of course, does not negate the fact that you know everything about meat and bones: data structures and algorithms. But this is very easy to find on the Internet at the request of a hacking code interview. Otherwise, of course, my first paragraph (“Always say”) will only make you worse. Always learn!