# DE Shaw Internship Interview Experience | On-Campus 2022

D.E. Shaw held an on-campus recruitment drive in my college for the position of QTE intern (2 months) in July 2021.

There were three rounds for the selection process :

**Round 1(Technical Test-95 minutes on Hacker Rank): **There were a total of three sections in this test.

- The first section comprised of 14 Aptitude MCQs of easy to medium level difficulty to be completed in 28 minutes.
- The second section is comprised of 12 Technical MCQs related to finding errors in the logic of C++ codes, guess the output of the code questions, DBMS, SQL, and related concepts to be completed in 17 minutes.
- The third was a coding section which had two coding questions, with 20 minutes and 30 minutes for the first and second questions respectively. The two questions were : (i) Given an array of n integers, you can divide the array into sections containing k elements each (n is divisible by k). The score of each section is the product of the elements in that section. Find the maximum sum of scores of all sections that you can achieve. (ii) Given that you have three items A, B, and C that you need to put them in a particular order such that there are no three consecutive same items. Given n queries of the form (a, b, c) where a, b and c are the number of items A, B, and C that you have, find the maximum number of A, B, and C items that you can order by following the above constraint. (the constraints were low)

**Technical Interview Round 1(60 minutes on Hacker Rank Code Pair): **There were two interviewers. One of them was running a bit late, the other interview started with his introductions, and then asked for mine. He then said that the other interviewer is a bit late and why don’t we start with the first problem till then:

- The first problem that I was given was as follows: We have N blocks that are required to be painted by using K colors with the following condition that at most only 1 pair of adjacent blocks could have the same color. This was a type of DP problem which I quickly identified and gave them the recursive and the memorized approach. He told me to do some dry runs and then he seemed satisfied with the solution.
- By now the second interviewer had joined and he started by giving me a puzzle: We go from our house to the office and back, it is given that the traffic lights are always red whenever you encounter them. Now while going from your house to the office, you stop two times but while returning home from the office you stop only once. How is this situation possible. He asked me to draw and explain my solution properly. (Hint: You don’t need to stop in a traffic light when you need to turn left). It took me about 5-10 mins to solve this puzzle.
- He then asked me the next problem. There is an N-floor building and you have one egg. You need to find the lowest floor from which the egg breaks on dropping. Given that the egg breaks after a certain floor and above it and doesn’t break from any floor below it. The only solution is where we throw the egg starting from the lowest floor and go upwards until it breaks, this cannot be further optimized as we have only one egg. He then asked me the time complexity for this solution to which I said it was O(N).
- Then he modified the question and gave a follow-up to the previous problem asking what would be the most optimal method if we had 2-eggs to find the lowest floor from which the egg breaks on dropping. At first, I gave another O(N) approach but he asked if there was another more optimized approach to which I gave a binary search approach. We would use one of the eggs to shorten our search range and then perform a linear search in the new range. He then asked me which floors would have the worst case and best case here the worst case and best case refer to the floor till which we’d have to make the least number of drops.
- Now the first interviewer asked me if I knew what LRU cache is? To which I told them that I only know a little bit about it and explained whatever I knew. He then asked me to Implemented a system that would work as an LRU cache. This was a design problem. At first, I gave them a very unoptimized approach for which they asked me if I could make it more efficient. I was not able to get to the most optimized solution, I reached a system where we’d have a priority queue-like structure with a hashmap. The intended solution to it was based on a priority queue of linked lists and hashmap.
- In the end, they asked if I had any questions, and I asked about what they work on and what their role was.

**Technical Interview Round 2(60 minutes on HackerRank Code Pair): **There were two interviewers again. After introduction they started with the questions :

- They started with a mathematical puzzle where he asked to find which of the two is bigger, 50^(99) or 99!, once I said that 50^99 was bigger they then asked me why? I was able to give a logical answer where we changed both the numbers in terms of 100 and then compared them but they didn’t seem fully satisfied with it.
- The second question that I was that there are a lot of students and a lot of courses, where a student is allowed to take part in as many courses as he’d like to. We are making an exam-timetable in which every student should give only one exam a day and the number of days the exam spans over should be minimized and we are required to find the minimum number of days it would take to conduct the examination. For example: If there are two students and they opted for courses as follows: student 1: M,P and student 2:M,C. Then we can have the examination as follows: Day 1: {M} and Day 2: {P,C). This way no student has to give two exams in one day and the span of the total days is minimized. It took me a while to finally observe that we can have a graph-like structure where the nodes would represent one course and the edge would represent that there is a student who has both the nodes connected by that edge as subjects. Now to find the minimum number of days we would have to perform topological sorting and find the number of different levels in the topological sorted graph. He then asked me what is topological sorting followed by a real-life example and how would we install modules in a project where a module could be dependent on some other module which is required to be installed before it (Topo-sort again).
- The other interviewer then gave me another problem which was as follows: We have a database sort of table, which because of some manipulation been changed as follows – the rows and the columns both have to be jumbled in some random manner, We are required to check if the data in the table is still consistent or not (Jumbled data is consistent as long as the values have not been changed). I gave an approach where we could perform custom sorting on the columns and then check the consistency of the rows with the help of the primary key and the original table. To which he asked me to solve this in some other manner for which I told him that we could have the table modified and become an array of structures and then be checked for consistency easily he then asked if I could solve it using classes and objects for which I said I can, he then didn’t ask me to code the problem and explain the difference between a class and a structure.
- By now the time was almost up so they asked me a final question, this was more of an open-ended problem where I was required to tell what all things should be tested on a check-out page of an e-commerce website (such as Flipkart). I told a few points such as checking if two people are paying and only one item is left, consistency of item with the database, etc. In the end, they asked if I had any questions, and I asked what they work on and what an intern would work on.

After each round, you can ask any questions that you may have to the interviewers.