📜 ⬆️ ⬇️

Parsing badoo php tasks and new test How to get an offer to London in February



Hi, Habr!

In July, we held a recruiting event for PHP developers, as a result of which five people received an offer to our London office. We continue to grow rapidly: since that time , the Android and iOS teams have increased by 11 people , so we are again launching a contest for PHP developers.
')
The rules are the same: show high results in the test , successfully pass an interview on February 10 or 11 in Moscow - get an offer to the London office of Badoo.

The company assumes all expenses upon arrival at the interview in Moscow, as well as everything related to the further move to London: work visas for family members, £ 10,000 (≈ 770,000 rubles) for moving, improving English, finding accommodation.

To perform the test task it was more interesting, according to numerous requests ( 1 , 2 , 3 ) under the cut, we will analyze the tasks from the previous event, consider their correct solutions, and I will explain why we chose them, and also give some examples, statistics and options decisions from candidates.

UPD: Event is complete. Following the results, 7 people joined us.


First of all, I want to note that the online test is a kind of compromise. This is such a synthetic assessment of knowledge and skills of a person, which, although correlated with the ability to solve real problems, does not always accurately reflect them.

In Badoo, we rely on people, on personal qualities. Therefore, we always try to personalize the interviews as much as possible: it’s not so much the fact of solving the problem that is important for us as it is how a person thinks and reasons.

Therefore, if you are not lucky with the dough, do not be discouraged. Come to us in the standard way - and, perhaps, in our usual interview you will show yourself better. The same applies to those who do not want to move to London - we have excellent vacancies in Moscow!
Nevertheless, it is somehow necessary to conduct the primary selection, so we decided to use an online test for this purpose.

To justify the choice of tasks for the test, you first need to clarify why we generally use it, what and how we check with it.

So, the test allows us to solve two problems:


Primary selection


We solve the problem of primary selection using writing tasks for SQL and PHP code with automatic verification. Thanks to the automation of the last time, of the 950 solutions obtained, we checked only 150 manually. That is about 15%.

We set the following requirements as basic:


Choosing the best


Candidates who have passed the first stage of selection are already quite good. This does not indicate their ideal readiness, but a good base is a guarantee that a person is already potentially suitable for us or will be suitable in the future with proper training.

How to choose the best among potentially suitable? This process is more difficult to formalize. Therefore, at this stage, we decided to use tasks with a large scope to demonstrate knowledge and experience from various fields. And each successful application of such abilities was considered a plus.

It is impossible to cover all areas with a single list, so I will give a few examples of topics to which we paid attention:


Tasks


As a result, we chose six tasks that cover our requirements:


All task texts were written in English, so minimal possession was checked automatically.

Here, for convenience, I will provide texts in Russian and minimize them, leaving only the essence.

For example, let's look at three tasks from the past test.

Task number 1. "The sum of large numbers"


Condition
A string is given containing two positive integers separated by a space. Numbers can be large and do not fit into a 64-bit integer. It is necessary to display the sum of these numbers.

Typical solution
function sum_str($str) { list($s1, $s2) = explode(' ', $str); $l1 = strlen($s1); $l2 = strlen($s2); $result = ""; $rest = 0; for($i = 1; $i <= max($l1, $l2) + 1; $i++) { $d1 = $s1[$l1 - $i] ?? 0; $d2 = $s2[$l2 - $i] ?? 0; $sum = $d1 + $d2 + $rest; $rest = intval($sum > 9); $result .= $sum % 10; } return strrev(rtrim($result, '0')); } 


The task is simple. With it, we test the ability to program in PHP. 201 people solved it correctly. Another 63 candidates passed part of the verification scenarios, but did not pass any regional cases.

One of the possible optimization of the solution is to take more than one digit of the number in each iteration of the cycle, but several (N) at once. Here it is important to take into account that both the numbers themselves, consisting of N digits, and the sum of two such numbers, must fit into 63 bits, because in PHP all int'y sign. It turns out that you can take as many as 18 digits at a time.

We have marked such solutions as interesting, although units have resorted to them.

After the publication of the task, we found out that the platform does not allow managing the available PHP extensions to solve it. Therefore, the task could also be solved using GMP (gmp_add ()) and BC Math (bcadd ()). We regarded such solutions as correct along with the rest, despite the fact that in this case they boiled down to a couple of lines of code.

Task number 2. "Parentheses"


Condition
At the input there is a string containing only brackets from the set {} () []. It is necessary to determine whether it is balanced or not.

By balanced is meant a line in which three conditions are met:


That is, [([] {[]})] is balanced, and {[}], [()] and] {} [- no.

Typical solution
 function balanced($str) { $braces = [ '}' => '{', ')' => '(', ']' => '[', ]; $stack = []; for($i = 0; $i < strlen($str); $i++) { $char = $str[$i]; if (isset($braces[$char])) { $el = array_pop($stack); if ($el != $braces[$char]) { return 'NO'; } } else { array_push($stack, $char); } } return $stack ? "NO" : "YES"; } 


The task tests both general knowledge of PHP and computer science (algorithms). 231 people decided it completely correctly. Even 99 candidates had some test scenarios, but not all.

The shortest way to solve this problem is to delete from the string all the combinations “()”, “{}” and “[]” until the string stops changing. Although we made this decision, we marked it as not optimal. In this case, you need to make multiple passes on the line and re-allocating memory, while the solution on the stack is performed in one pass and has the complexity O (N).

Some participants used to implement the SplStack stack instead of array (). We considered such solutions equivalent, although, by the way, SplStack used units.

Task number 3. Wikipedia


Condition
There is a task to download all the pages of the English-language “Wikipedia” (only HTML, no images, CSS, JS).

There are ten servers (each with 24 cores), an endless fast disk and RAM, gigabit Internet.

It is necessary to estimate the time it will take to complete the task and justify it by describing the solution algorithm. No code is required.

Explanation
Using this task, we wanted to assess the candidates' ability to decompose the real “life” task, separate important information from the condition and correctly determine / substantiate the deadlines.

There is no reference solution here, so here are the main points to which we paid attention first of all:


12 people coped with this task more or less successfully. 55 more decided it partially.

Where to pass the new test


Now that it has become clear how we select tasks and evaluate their solutions, it’s time to remind you that a detailed description of the event, conditions and a fresh test is here . You can pass it until January 26.

More details about the team and tasks can be found in the announcement of the previous event on Habré. And here you can read the success story about our colleague Anton Rusakov moving to London.

Have questions? Feel free to ask them in the comments or send me to Habropochta.

Take the test, come to us for an interview - and join our friendly team! It will be interesting!

Good luck!

Pavel Murzakov, PHP Team Lead, Badoo.

UPD: we will answer until February 7-8.
UPD2: event completed. Following the results, 7 people joined us.

Source: https://habr.com/ru/post/346652/


All Articles