# D E Shaw Interview Experience | Set 16 (On-Campus for Internship)

First shortlisted based on CGPA >= 7.5 and ONLY CSE student allowed to sit in interview. They(D-E-Shaw) had 2 phases of selection procedure.

**FIRST PHASE :**

**TECHNICAL INTERVIEW : **

First they asked to me introduced myself and they asked my interest. I told them about me and mentioned my interest areas as Data Structure And Algorithm. Then they start a discussion about DSA.

Q 1). Implement Stack using two Queue.

Q 2).Implement Queue using two Stack.

Both questions are quite easy BUT you should know thoroughly how to implement and what action should we take on the particular query and working code too.

Then they asked me to write code for both problem and analyze Time complexity of each operation.

(Advice: read this Book Data Structures and Algorithms Made Easy – Narasimha Karumanchi to understand thoroughly to basics of Data structure…)

After this, they asked my project(OS Based) and asked me the following Question :

1). What you have done in your project which is not present before?

2). How it can affect to a real-world application?

3). What difficulties did you face in your project?

4). How you can implement to Real-Time OS?

……lot more other stuff about it.

And asked a lot more Question about OS.

(Advice: Don’t mention the project in which your contribution is very less or don’t know fully about that project. They don’t expect a lot of project from interns BUT they want to know how much effort you put in your project and how well know you your project…Be ready with all stuffs…….)

Then again, They asked a very good question Algorithmic Based(step by step, they increased difficulty level).

They said…

You have an array size with some integer. You have to return the sum of Lth index to Rth index of an array element(inclusive).

I just write a function which will run within the given range and return the sum.

Time Complexity of Each Query: O(R-L)

They asked me to optimize to further with this solution…..as they are not happy with my solution.

After a while, I came up a solution using one more array say cumm_Array in which I will store the sum of all element 1st to ith indexed element at cumm_Array[i]. For each Query I will return (cumm_Array[R]-cumm_Array[L-1]).

I can not stop me to write code because I love coding……….

Here is code :

`//here all array is 1-Based indexed ` ` ` `int` `cumm_Array[size+1]; ` `void` `cumm_Sum(` `int` `arr[],` `int` `size){ ` ` ` ` ` `int` `cumm_Array[0]=0; ` ` ` ` ` `for` `(` `int` `i=1;i<=size;i++) ` ` ` `cumm_Array[i]=arr[i]+cumm_Array[i-1]; ` `} ` ` ` `int` `Query(` `int` `L,` `int` `R){ ` ` ` ` ` `return` `(cumm_Array[R]-cumm_Array[L-1]); ` `} ` |

*chevron_right*

*filter_none*

Time Complexity Each Query: O(1)

Over All-Time Complexity: O(N*1)

Now they said to me …you have to perform two queries.

Query 1). Update ith element to given value say x

Query 2). Calculate the sum of the given range

Now question become difficult.

(Hints: This can be done using Binary Indexed Tree or Segment Tree..don’t worry if you don’t know..

here is my code…

Segment Tree Implementation.

Binary Indexed Tree Implementation.

Now Time complexity for Query 1 : O(logN)

Time complexity for Query 2 : O(logN)

Now they asked me to write Pseudo code for this… I have done this…After this, I saw faces of them. They are looking impressed because they are not expecting me that things..because for solving first 2-question I took 10-15 minutes to each.

**HR INTERVIEW **

In this phase, they asked about ourself, some regular HR questions. After this, they asked some puzzles and a lot more stuff which only about our general awareness.

Advice: Be cool and attentive.

**SECOND PHASE :**

**TECHNICAL INTERVIEW**

First, they said to me, “Now you are in 2^{nd} phase ”. They asked me about 1^{st} phase interview experience.

After that, they asked the first question based on the real problem which requires data structure concepts.

Q 1). Suppose you have to store buyer_id, buying_time, dept, beyer_contact_info. Design a data structure to store this information.

Now they added some more stuff to question to make it hard. They said, “You have to find a buyer who spent maximum money for shopping in each half an hour interval in each dept”. Again they asked to find a buyer who spent maximum money from previously selected buyer’s list.

Later they asked me to announce the winner provided some more constraints. This question was very heavy in the whole interview process.

They asked me to write code(not pseudo code) for this problem quickly and analyze time complexity and space complexity.

Q 2). Design a DFA for binary input(0’s and 1’s string) whose decimal value is multiple of 5.

Q 3). You have two number say A and B. You have a given range say [L, R] set all bits in B in given range who all bits are set in A in that range. (didn’t get, Sometimes They mention things which seems to very ambiguous, They want to how you tackle these kind problems…If you ever face these kinds of the situation…Please ask for more clarification..)

I didn’t get a question at all. They laughed at me……….lol..I also feel very sad. At last, what happened to me.

Then they clarify like this…

You have to set all bits in Binary Representation of B who are set in A between given Lth position to Rth Position in Binary Representation of A.

Then I demonstrated an example to them…(If you also didn’t get see example).

A = 10(1010) B = 13(1101) [L,R] = [2,3] bit position 1 ,2 , 3 ,4 A 1 0 1 0 B 1 1 0 1

Here you can see between range [2,3], A have 2^{nd} Position bit is unset which set in 2nd Position in B and 3rd position bit of A will be unaffected. You should set an only 2^{nd} bit of A

Final ans : A = 14(1110)

NOTE: don’t unset bits in A who already are set and don’t perform any operation out of range.

Solution:

The first solution I gave them, just convert A and B in binary and do required operation as mentioned in the question and get back decimal value from the answer.

Then they asked me to optimize further with saying that computer store every information in binary.

I was just thinking that this question can be done by simple XOR-ing as I had already solved some problem on bits.

After a while, I came up with a solution of constant time complexity.

I design a bit-mask having all 1’s in a given range and AND with B, finally OR with A;

Choosing such bit-mask programmatically is not so tough, so left to the reader.

BEST OF LUCK

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

## Recommended Posts:

- D E Shaw Interview Experience | Set 21 (For Internship)
- DE Shaw Interview Experience (for Internship)
- D E Shaw Interview Experience | Set 22 (For Internship)
- DE Shaw Interview Experience | SDE Internship
- DE-Shaw & Co Interview Experience | On-Campus Internship
- DE Shaw Interview Experience | Set 24 (On-Campus for internship)
- D E Shaw Internship Interview Experience (On-Campus)
- DE Shaw On-Campus Internship Interview Experience 2019
- D. E. Shaw interview experience for internship (On Campus 2018-2019)
- MathWorks Interview Experience (EDG, Oncampus)
- UHG Interview Experience | OnCampus- 2019
- ServiceNow Interview Experience Oncampus
- InfoEdge Interview Experience | OnCampus-2019
- DE Shaw Internship Experience
- DE Shaw Internship Experience (On campus)