# D.E. Shaw Interview Experience (On-Campus)

Last Updated : 11 Jul, 2023

I am from MNNIT Allahabad 3rd year Student, and my internship was in the 2nd summer days when the 1st company D.E. Shaw visited and 12 boys were selected in the coding round.

This company allows only CSE, ECE, and EE, but mandatory cpi for CSE and ECE  (7 cpi) and EE (8 cpi). Other branches are not allowed.

#### Round 1:It was a coding test on the HackerRank platform. Three simple algorithmic questions were asked there that required the best knowledge of STL (for C++), Dp, strings, and math. The test duration was 90 minutes.

```1. Odd Substrings :
Given a string input str, find the number of its ALL substrings that contain at least one character that appears an odd number of times. o Note: A substring is defined as any contiguous segment of the string.
Example
Suppose input_str = "aabc"
2
Here substrings containing at least one character with an odd frequency are "a", "b", "c", "aab", 'laabc", Nab", "abc'l and "bc". Thus, the answer is 9.
3
Function Description Complete the function getNumOddSubstrings in the editor below.
getNumOddSubstrings has the following
parameter:
input_str: a string
Returns long int: the number of substrings with at least one character that appears an odd number of times```
```2.minimum Cost
Given an array of n integers, choose any two of the first three elements of the array and remove them. The cost of such an operation is the sum
of the two elements removed. For example, in the array [1, 2, 3, 4, 5], (1, 3) can be removed at a cost of 3, (1, 2) can be removed at a cost of 2, but (2, 4) can not be removed as 4 is not among the first three elements of the array.
If there are fewer than three elements left in the array, remove all of them at the cost of the maximum of the remaining values.
Find the minimum cost to remove all the elements from the array.
Example
Suppose n = 4, arr = [3, 1, 4, 2]. Among the possible options for the first step, i.e., {3,1), (1, 4), and (3, 4)}, it is optimal to remove (3, 4) at a
cost of 4. The remaining array in that case would be [1, 2]. You can now remove both elements at a cost of 2. Thus, the total cost to remove all the
elements from the array is \$6. Removing any other combination in the first step, i.e., either of (3, 1) or (1, 4), would lead to a higher
overall cost. For example, removing (3, 1) in the first step```
```3.Pair Product Queries
For an array arr of n integers, the prefix maximum index i is defined as the maximum value of the prefix array up to the index i, i.e., max(arr[0], arr[l], arr[2], arr[i]). Similarly, the suffix minimum of index j is the minimum value of the suffix array starting from index i, i.e., min(arr[i], arr[i +1], arr[i +2], arr[n - ID]. i Given the array array, report an array of q integers where the kth element of the array represents the number of pairs of indices (i, j) such that 0 S i, j <  n, the product of the prefix maximum of the index and the suffix minimum of the index in the array, is exactly equal to queries [k].
Example
Suppose n = 3, q = 1, and arr = [l, 2, 3]. and queries The only two pairs satisfying the condition will be (0, 1) and (1, 0). For the first pair, the prefix
The maximum of 0 will be 1, and the suffix minimum of index 1 will be 2. The product of the two values is 1 *2 = 2. Similarly, the prefix maximum of index 1 is 2, and the suffix minimum of index 0 is 1. The product of the two values is 2 x 1.```

#### Round 2 :(60-minute technical interview on Hacker Rank Code Pair): There were two interviewers, both of whom introduced themselves and told about their work in the company. After this, they asked for my introduction. The summary of the questions asked is :

1. Java-OOP related questions on Constructors. Given a stream of numbers, find the median of numbers.
2. Questions were asked about implementing Generic Arrays, as well as the fundamental differences between JAVA and C++ coding.
3. Given a 2-D grid of characters and a list of words, find how many words can be found inside the grid. We can search in all 8 directions.
4. A question on the greedy approach, in which the interviewer tried to confuse me that the solution has to be by Dynamic Programming, but it wasn’t.
5. Given a stream of numbers, find the median of numbers.
6. A couple of DP questions on stock selling, given the prices of them on each day.
7. Which data structure can be used to implement LRU Cache?

Round 3 :(60-minute technical interview on HackerRank Code Pair):

• 1. Explain dangling pointers.
• 2.SQL query: Find the 5th largest salary in a given Salary table.
• 3. What is the use of volatile keywords in Java?
• 4. How can you search for an element in a rotated sorted array?
• 5. Given a binary tree, first, print its left side view then its right side view. Print the root node only once. He just wanted the approach and time complexities and asked me to dry run my approach and explain in detail for two test cases.
`Verdict â€“ Selected`

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

Best wishes!

Previous Article
Next Article
Article Tags :
Practice Tags :