0 like 0 dislike
962 views
| 962 views

0 like 0 dislike

Round 0: Online Coding and Aptitude Test

This test had 26 MCQs (14 aptitude + 12 technical) and 2 coding Questions

Out of 250 students 2 (me and one of my batch mate) were selected for the next round.

Round 1: Codepair Round (60 mins) | Hackerrank

The number of questions asked in this test were not fixed for every candidate, basically it depends on the interviewer.

• First Question(Cakewalk) :  Given two numbers ‘a’ and ‘b’ having equal number of digits. The task is to find the minimum number of moves required to convert ‘a’ to ‘b’In on move you can increment or decrement any digit of ‘a’ by 1. For example: a = 45, b = 34, Answer = 2 (Increment by and decrement 5 by 1). Although it looks easy but there is a corner case which you need to handle and this is what he was looking for.
• Second Question(Open ended) : There are many telecom towers in a region, each tower have a certain signal range and bandwidth range. However for every pair of towers having an overlapping signal rangethere should not be any point which is lying in the bandwidth range of both the towers (i.e. their bandwidth ranges should not overlap each other). The task is to find the minimum number of unique bandwidth ranges which we can use to assign all the towers. The input will not contain the signal ranges of the towers, it will only contain a list of pair of towers where each pair of towers will signify that the signal ranges of these two towers are overlapping with each other. I gave an approach using graph but it was failing at some cases.
• Third Question(Maths and Bitwise Operators) : You are given a method which can generate 0 and with 50% probability. You need to design a new method which can generate 0 with 75% and 1 with 25% probability using the given method. I used bitwise AND operator to perform the given task.

Both of us (me and my batchmate) got selected for the final round.

Round 2: Codepair Round(60 mins) | Hackerrank (Final Round)

First Question (it was an open ended question, so it took me some time to think of an optimized approach): You are a given a text written in JSON (I was shocked to see that because I haven’t ever coded anything in JSON). He wrote a small code in JSON on the editor, I will try to write that code below.

```As far as I remember the below code is what the interviewer wrote.

Note: There might be some syntax errors(although it will not make
the question wrong) in this code as I don't know JSON,
I will try to replicate what he wrote there.

Code:

A:
{
B:
{
C:
{
D = 45
}
}

C:
{
B = 98
}
}```

The interviewer said that in this JSON code there is a hierarchy in every path, for example A -> B -> C -> D {45} is one path similarly A ->  C -> B is another path. By hierarchy he meant to say that there is a path from A -> B in this code but there is not  a path from B -> A, which means that we can reach from A to B but not from B to A (similarly for other parts of the code).

Note: All paths are independent to each other (on the basis of hierarchy), like here we can see that in the first path (A -> B -> C -> D), B is the parent of C, but in the second path (A -> C -> B), C is the parent of B.

Now he asked me to design a structure which can store this information from this code and answer the queries efficiently. For example if the query is A.B.C then answer will be {D:45}, similarly if the query is A.C.B then answer will be 98, formally I have to return all the information inside the given path or determine that the given path is invalid. An invalid path means a path which does not exists for example B.A

I firstly thought of something like a directed graph looking at the information but later I thought that for finding the answer for each query we have to use DFS which is a costly operation because of the fact that  we have to perform it for every query. Lastly I thought an approach using TRIE data structure (better than the previous one) and I was able to code it at the time of interview ( I will be happy to see better approaches in the comments  ).

Second Question : This was the last question of the final round and it was based on DBMS. Given an employee table, find all data of the employee having maximum salary.

Two days after the interviews results were declared, and unfortunately both of us were not selected for the internship, although one more college was taking part in the same drive and two students from that college got an offer after this round. However we are still happy as we at least got the experience of how the coding interviews are held, since it was our first time.

UPDATE: Forgot to mention that I got rejected because I was asked 2 questions based on OS and CN which I had no idea about….

PS : Unlike most other interviews of D E Shaw, this interview was not composed of too much questions on CS Core subjects, except the last one.

by Expert (30,360 points)