D.E.Shaw interview experience Real time questions & tips from candidates to crack your interview

Software Developer

D.E.Shaw
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Referral
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Face to Face
Duration45 minutes
Interview date9 May 2015
Coding problem2

Technical Interview round with questions on DSA.

1. Convert a Binary Tree into its Mirror Tree

Easy
15m average time
85% success
0/40
Asked in companies
AdobeWalmartThales

Given a binary tree, convert this binary tree into its mirror tree.

A binary tree is a tree in which each parent node has at most two children.

Mirror of a Tree: Mirror of a Binary Tree T is another Binary Tree M(T) with left and right children of all non-leaf nodes interchanged.

alt text

Note:
1. Make in-place changes, that is, modify the nodes given a binary tree to get the required mirror tree.
Problem approach

This can be solved using recursion. 
Steps :
(1) Call Mirror for left-subtree i.e., Mirror(left-subtree)
(2) Call Mirror for right-subtree i.e., Mirror(right-subtree)
(3) Swap left and right subtrees.
temp = left->subtree
left->subtree = right->subtree
right->subtree = temp

Worst-case Time complexity is O(n) 
Auxiliary space complexity : O(h) where h is the height of the tree.

Try solving now

2. Maximum Sum Subarray

Moderate
25m average time
75% success
0/80
Asked in companies
CultfitPayPalWalmart

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.


For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements 42, 14, -5, and 86.


Given the array [-5, -1, -8, -9], the maximum sum would be -1.


Follow up: Do this in O(N) time.

Problem approach

The direct approach to solve this problem is to run two for loops and for every subarray check if it is the maximum sum possible. 
Time complexity : O(N^2), Where N is the size of the array.
Space complexity : O(1)
The efficient approach is to use Kadane's algorithm. It calculates the maximum sum subarray ending at a particular index by using the maximum sum subarray ending at the previous position. 
Steps : 
Declare two variables : currSum which stores maximum sum ending here and maxSum which stores maximum sum so far.
Initialize currSum = 0 and maxSum = INT_MIN.
Now, traverse the array and add the value of the current element to currSum and check : 
1. If currSum > maxSum, update maxSum equals to currSum.
2. If currSum < 0, make currSum equal to zero.
Finally, print the value of maxSum.

Try solving now
02
Round
Hard
Face to Face
Duration45 minutes
Interview date9 May 2015
Coding problem2

Technical Interview round with questions on DSA.

1. Find the largest BST subtree in a given Binary Tree

Easy
10m average time
90% success
0/40
Asked in companies
OlaSalesforceD.E.Shaw

You have been given a Binary Tree of 'N' nodes, where the nodes have integer values. Your task is to return the size of the largest subtree of the binary tree which is also a BST.


A binary search tree (BST) is a binary tree data structure which has the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.


Example:
Given binary tree:

Explanation

In the given binary tree, subtree rooted at 2 is a BST and its size is 3.
Problem approach

The simple approach is to start from the root and do an inorder traversal of the tree. For each node N, check whether the subtree rooted with N is BST or not. If BST, then return size of the subtree rooted with N. Else, recur down the left and right subtrees, and return the maximum of values returned by left and right subtrees.


Time Complexity : The worst-case time complexity of this method will be O(n^2). Consider a skewed tree for worst case analysis.
 

In the above approach, we traverse the tree in top-down manner and do BST test for every node. If we traverse the tree in bottom-up manner, then we can pass information about subtrees to the parent. The passed information can be used by the parent to do BST test (for parent node) only in constant time (or O(1) time). A left subtree need to tell the parent whether it is BST or not and also needs to pass maximum value in it. So that we can compare the maximum value with the parent’s data to check the BST property. Similarly, the right subtree need to pass the minimum value up the tree. The subtrees need to pass the following information up the tree for the finding the largest BST. 


1) Whether the subtree itself is BST or not (In the following code, is_bst_ref is used for this purpose).
 

2) If the subtree is left subtree of its parent, then maximum value in it. And if it is right subtree then minimum value in it. 
 

3) Size of this subtree if this subtree is BST (In the following code, return value of largestBSTtil() is used for this purpose).
 

Time Complexity : O(n) where n is the number of nodes in the given Binary Tree.

Try solving now

2. Next higher number with same number of set bits

Easy
10m average time
90% success
0/40
Asked in companies
AmazonGrofersNagarro Software

Given a positive integer ‘n’, your task is to find the next smallest integer and the previous largest integer having the exact number of ‘1’ bits set in their binary representation as ‘n’.

Example:
‘n = 6’
The binary representation of 6 = ‘0110’, which has two ‘1’ bits set.
Next smallest integer = 9 = ‘1001’, the smallest integer greater than 6 having two ‘1’ bits set.
Previous largest integer = 5 = ‘0101’, largest integer smaller than 6 having two ‘1’ bits set.
Therefore, the answer is {9, 5}.
Note:
1. ‘n’ is a positive integer greater than one.
2. For any given integer ‘n’, there is always a positive integer smaller than ‘n’ having the exact number of ‘1’ bits set.
3. Don’t print anything. Just implement the function and return the answer.
4. ‘n’ can have a max of ‘30’ bits.
Problem approach

When we observe the binary sequence from 0 to 2n – 1 (n is # of bits), right most bits (least significant) vary rapidly than left most bits. The idea is to find right most string of 1’s in x, and shift the pattern to right extreme, except the left most bit in the pattern. Shift the left most bit in the pattern (omitted bit) to left part of x by one position.

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
Software Developer
1 rounds | 6 problems
Interviewed by D.E.Shaw
1300 views
0 comments
0 upvotes
Software Developer
3 rounds | 10 problems
Interviewed by D.E.Shaw
922 views
0 comments
0 upvotes
SDE - Intern
3 rounds | 6 problems
Interviewed by D.E.Shaw
866 views
0 comments
0 upvotes
Technology Developer
3 rounds | 13 problems
Interviewed by D.E.Shaw
1523 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Developer
5 rounds | 14 problems
Interviewed by Microsoft
4030 views
1 comments
0 upvotes
company logo
Software Developer
6 rounds | 12 problems
Interviewed by SAP Labs
2912 views
0 comments
0 upvotes
company logo
Software Developer
3 rounds | 3 problems
Interviewed by Amazon
1271 views
0 comments
0 upvotes