what C++ developers are asked during an interview at Yandex

“C++ Developer” And “C++ for the backend” in Yandex Praktikum.

I also help the company with hiring and conduct preliminary sections with candidates – C++ developers. I will tell you what tasks I give in these sections, what I pay attention to and how to prepare for such an interview.

What are pre-sections?

When a backend developer responds to a vacancy at Yandex, an HR manager responds, studies the candidate's resume and checks how well the experience described in it fits the vacancy, and then establishes the first contact and evaluates soft skills. If the developer passes the check, he is admitted to a technical interview, which consists of several stages.

The first of them — preliminary sections — is conducted by me, among others. I have an hour in Zoom to give the candidate problems, watch how they solve them, and ask additional questions. Then I leave feedback about the potential employee for the next hiring specialist. I write whether the candidate solved the problems and answered the questions, how confidently they did it. I also make notes on their soft skills: how correctly they communicated and how nervous they were (especially relevant for those who are going through such sections for the first time).

Preliminary sections help test the candidate's general knowledge of C++, but this is not the whole selection. At the next stages there will also be tasks, and more difficult ones.

The preliminary sections consist of two compulsory tasks. In exceptional cases, there may be a third task and, if time remains, a short series of questions. Solutions are written in an online editor without compilation.

First task: simple, but not quite

Usually the first task I give is easy, it does not require knowledge of algorithms or complex calculations. It is enough to think a little and write the code carefully.

Yandex has its own pool of interview tasks, and unfortunately I can't share a real example. But there are similar tasks with Leetcode. For example, on find duplicates in array with condition.

The program accepts an array of numbers nums and a variable kequal to the maximum possible distance between identical values. If the conditions are met, equal numbers in nums there is and the difference between their indices is less than or equal kthe code should output trueif not, then false.

Or here’s the task for detecting repeating character sequences in a string.

To decide, you need to check whether the given string can be recreated by multiplying only part of the string, without adding any additional characters.

Surprisingly, people get stuck on the first task most often. Although it seems very simple and, in a certain sense, it is, sometimes even experienced developers cannot solve it. There is such a state: you think that you have done everything and foreseen everything, but then you are asked a tricky question, and you “float”. It is the same here: it seems that the code is written and everything seems to work, but suddenly some iceberg pops up and that's it – a stupor. The longest solution in my memory took 55 minutes out of an hour meeting.

Second task: algorithms

The second task I usually give is about algorithms. Its difficulty depends on how the candidate solved the first task. If I see that the person is confused and nervous, I give a simpler task. If the candidate passed the previous stage without problems, I give a more difficult one.

Example with Leetcode – solving a mathematical examplerecorded reverse Polish notation.

At the input we receive an array of numbers and operators. The code should produce the result of the solution.

One more example – problem about gas stations.

We are driving along a circular highway with gas stations. At every gas station i we pour into the tank gas[i] gasoline, and when we get there, we spend it cost[i] gasoline. At the input we receive arrays gas And costthe goal is to find out from which gas station index you need to start driving in order to go around the circle once, or return -1If this is not possible.

There are similar examples in “Algorithm training” from Yandex – a free course with lectures, homework and analysis of errors.

If there is time left

If the candidate easily solved both problems, then I can give the third one. But what exactly it is is no longer so important – it will not affect the outcome of the meeting and my feedback, even if the person cannot cope with it.

I can also ask the person questions about theory. Ask about smart pointers, multithreading and asynchrony (what are they, how do they differ and how are they related), containers (why are they needed? arrayif there vector?) and so on. But this is an optional part of the interview – after all, solving problems covers these basic questions well, since a person uses functions and containers. Without knowledge of theory, he will not succeed.

What do I pay attention to

There are several criteria that influence my evaluation of candidates.

Successful problem solving. Of course, this is the most important thing. But at the same time, if something does not work out, this is not a reason to eliminate the candidate in the preliminary sections. At the very least, I will try to push the candidate to the right decision. If I see that I cannot help indirectly, I can also directly suggest in which direction to think and why the solution proposed by the candidate is ineffective.

Even ignorance of functions is not something irreparable. Maybe the person is going for a minimum grade? In that case, I will clarify that the candidate is a potential intern.

Code style. In Yandex, you will work in a team, so your code should not only work, but also be understandable. Candidates have problems with this. Here are some common mistakes:

#include <iostream>
 
bool func(vector<int>& v) { // тут плохи непонятные название функции и параметра + то, что параметр передаётся по ссылке, а не по константной ссылке (но это зависит от задачи)
...
    for(int i = 0; i < v.size(); i++) // тут плохо сравнение signed и unsigned (со всеми вытекающими)
    {
    }
    ...
    int some_params;
    ...
    some_params++; // нет смысла использовать постфиксный инкремент в этой ситуации
....
}

The problem with style is often encountered among Olympiad participants and those who have solved a lot of problems on Leetcode, but not in real projects in a team.

Reasoning. If the candidate thinks out loud, great. If not, that’s okay too, since he will still talk through the solution, and I can ask additional questions. Correct reasoning is more important than a solved problem – sometimes a person thinks correctly, pronounces the correct solution, but cannot fully implement it in code. It is worth noting that this is not an absolute inability to solve the problem – rather, I can turn a blind eye to the fact that the candidate did not implement the necessary, but not the most important, function. And if there is time left, we will still return to it. Most often, developers make such mistakes due to anxiety, and this is normal.

Communication style. It is ideal if the candidate communicates adequately, politely and calmly. If he is very nervous, and panic notes appear in his voice, this is also normal. But if the candidate is rude, expresses disdain and gets irritated in response to comments, then I will add to the verdict that the communication was not very successful. True, in my memory there have never been such developers.

The main question I ask myself at the end of each interview is: do I want to see this person on the team? If not, then this is the main and only red flag – I will write about this in the meeting results and describe what exactly I did not like. However, my verdict will not be unambiguous NO HIREI'll just share my impressions with the recruiter. To be honest, I've never met such candidates before.

How to prepare for preliminary sections in Yandex

Interviews are a big challenge even for experienced developers. I recommend starting to prepare a week in advance, because work tasks are in any case different from tasks in sections.

In preparation, I would include an hour a day for Leetcode. When I was preparing for hiring, I solved two Easy problems and one Medium problem. If I realized that the problem could not be solved in 15 minutes, I looked for a ready-made solution and tried to understand and implement it. If you confidently solve these tasks and can solve two Medium problems in an hour, then you can try Hard. But this level is usually not encountered in interviews.

Leetcode has a disadvantage for such preparation – the service shows the test on which the solution failed. This teaches impunity, because the cost of a mistake in an interview or in a real work task is higher. Therefore, I advise you to write code that will pass verification the first time, or at most the second time.

“Training on Algorithms” Yandex will be stricter with you – you will understand that the code does not work, but you will have to figure out why on your own. This can be very annoying, but it is useful.

It is also useful to review general theory – for example, the same questions about container types appear in many collections of “Popular C++ Interview Questions”.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *