Crack DE Shaw: Previous Year Coding Questions, Hiring Process & Prep Guide
Breaking into top tech companies like DE Shaw isn't just about talent—it's about preparation.
If you're aiming to land a role at this elite quant + tech powerhouse, this post is your complete roadmap:
From the hiring process, to coding questions, to the right resources to practice from.
Who is DE Shaw?
The D. E. Shaw Group is a global investment and technology development firm, known for hiring some of the brightest problem solvers.
Whether you're targeting:
- Software Development
- Quantitative Roles
- SDE Internships
DE Shaw interviews test your coding, problem-solving, and computer science fundamentals to the core.
DE Shaw Hiring Process (2024–2025)
While exact rounds may vary by role (SDE, Analyst, Quant Dev), the most common structure is:
1. Online Assessment (OA)
- Platform: HackerRank or a private DE Shaw portal
- Format:
- 2–3 DSA/coding questions (Medium–Hard)
- Time Limit: ~90 minutes
- Often includes optimized, real-world logic problems
Practice for free to clear MCQ rounds
2. Technical Interviews
- 2–3 Rounds
- Focus on:
- DSA & Problem-Solving
- System Design (for experienced roles)
- DBMS / OS / Networks / Low-Level Concepts
- Puzzles or logic-based scenarios
3. HR / Behavioral Round
- Resume deep-dive
- Projects & Internships discussion
- Culture fit, expectations, and general conversations
Best Resources to Prepare
DSA + Problem Solving Platforms
- LeetCode (Medium–Hard tag)
- GeeksforGeeks - DE Shaw Interview Questions
- InterviewBit – Great for DP, Trees, Backtracking
- Coding Ninjas / CodeStudio Practice Sets
Concepts to Master
- ✅ Arrays, Strings, Sliding Window
- ✅ Greedy + Dynamic Programming
- ✅ Trees / Graphs (BFS & DFS)
- ✅ Stack / Queue / Custom Data Structures
- ✅ Bit Manipulation & Combinatorics
- ✅ Sorting, Prefix Sum, and Binary Search Tricks
DSA Roadmap With free resources.
DE Shaw Previous Year Coding Questions
1. Minimum Total Max
Given an array arr
of n
integers, your task is to partition the array into subarrays such that each subarray is of size less than or equal to a given integer k
, and the sum of the maximum integers from each partition is minimized.
Find the minimum possible sum of the maximum integers of the partitions.
Example:
n = 4
,arr = [1, 2, 3, 4]
,k = 3
- It is optimal to divide the entire array into two subarrays. The first subarray is
[1]
and[2, 3, 4]
. The maximums of the respective partitions will be 1 and 4 respectively which sums to 5 which is the answer.
Function to Complete:
findMinTotalMax
with the following parameters:
arr[n]
: An array of integersk
: An integer denoting the maximum possible length of the subarray
Returns:
int
: The minimum total max sum
Constraints:
- 2 ≤ n ≤ 10⁵
- 1 ≤ k ≤ 10⁵
- 1 ≤ arr[i] ≤ 10⁵
Sample Test Case
Input:
n = 6
arr = [1, 3, 4, 5, 2, 6]
k = 3
Output: 10
2. HTML Tag Matching
You're given a string representing HTML tags. Determine if the tags correspond correctly (ignoring order). Return 1 if valid, 0 if invalid.
Examples:
- Example 1:
"<HTML><HEAD></HTML></HEAD>"
→ 1 - Example 2:
"<HTML><HEAD></HEAD></HEAD>"
→ 0
3. K'th Character of the M'th Shortest Permutation
For N, generate all permutations of [1,2,…,N] in sorted (lexicographic) order. You're given integers m and k. Return the k‑th character (element) of the m‑th permutation.
Example:
- N=3, k=2, m=2
- Permutations:
[1,2,3]
,[1,3,2]
,[2,1,3]
, … - So, the 2nd character of the 2nd permutation is 3
4. Maximize Sum in Second Array Under Threshold Constraint
You are given two integer arrays arr1[]
and arr2[]
, each of size N (1 ≤ N ≤ 10⁵), and an integer thresholdSum
(-10⁹ ≤ thresholdSum ≤ 10⁹).
Each element in the arrays satisfies: -10⁵ ≤ arr[i] ≤ 10⁵.
Your task is to find two indices i and j such that:
- 0 ≤ i < j < N
- arr1[i] + arr1[j] ≤ thresholdSum
- arr2[i] + arr2[j] is maximized
Return the maximum value of arr2[i] + arr2[j] that satisfies the above condition.
5. Count Good Array Partitions
You are given an array arr[]
of N integers (1 ≤ N ≤ 5000) and an integer k (1 ≤ k ≤ N).
An array is considered good if no element appears more than k times (i.e., its frequency is ≤ k).
Your task is to find the number of ways to partition the array into one or more contiguous subarrays, such that each subarray is a good array.
Return the total number of such valid partitions modulo (10⁹ + 7).
6. Maze
Problem Description:
You are stuck in a mathematical maze. Currently, you are standing at position 0 of the maze. You need to reach the Kth position of the maze in order to escape it. You are only allowed to move ahead. You can move X steps ahead if and only if X is a Fibonacci number.
The Fibonacci series is given by:
- F(1) = 1
- F(2) = 1
- F(N) = F(N-1) + F(N-2) for all N>=3
It's really suffocating inside this maze and you want to get out of the maze as early as possible. Therefore, you want to know the minimum steps in which you can escape the maze.
Input Format:
- The first line of input contains an integer T denoting the number of test cases.
- The next T lines contain integers denoting K[i].
Output Format:
For each test case, output a single line containing the answer to the test case.
Constraints:
- 1 <= T <= 10^5
- 1 <= K[i] <= 10^9
Sample Input:
2
10
5
Sample Output:
2
1
Explanation:
- Test Case #1: K = 10
- You can take steps 2 and steps 8. Note that both 2 and 8 are Fibonacci numbers. This will sum up to 10. Therefore, the minimum number of steps required is 2.
- Test Case #2: K = 5
- You can directly take a step of 5 as 5 is a Fibonacci number. Therefore, the minimum number of steps required is 1.
7. Building Monuments
Problem Description:
The country of Hackerland can be represented as a tree of g_nodes
cities numbered from 1 to g_nodes
. The cities are connected by g_nodes - 1
bidirectional roads where the i-th road connects the cities g_from[i]
and g_to[i]
.
The king of Hackerland wants to build one of m different types of monuments in each of the cities such that no two adjacent cities or no two cities adjacent to a common city have the same type of monument. Find the number of ways to build the monuments in all the cities as described. Since the answer can be large, print it modulo (10^9 + 7).
Two cities are considered adjacent if they are directly connected through an edge.
Function Description:
Complete the function getTotalWays
in the editor below.
getTotalWays has the following parameters:
int m
: the number of monument types availableint g_nodes
: the number of citiesint g_from[g_nodes-1]
: one end of each edgeint g_to[g_nodes-1]
: the other end of each edge
Returns:
int
: the number of ways to build the monuments, modulo 10^9 + 7.
Constraints:
- 2 ≤ g_nodes ≤ 10^5
- 1 ≤ g_from[i], g_to[i] ≤ g_nodes
- 1 ≤ m ≤ 10^5
- It is guaranteed that the given edges form a tree.
Sample Input:
3
4 3
1 2
1 3
2 4
Sample Output:
6
Explanation:
The tree structure shows:
- Node 1 is connected to nodes 2 and 3
- Node 2 is connected to nodes 1 and 4
- Node 3 is connected to node 1
- Node 4 is connected to node 2
Pairs (1, 2), (1, 3), (2, 4) are adjacent to each other. Pairs (1, 4) and (2, 3) are adjacent to a common node, 2 and 1 respectively. Pair (3, 4) can have the same type.
A total of 3 types is needed. There are 6 possible ways: [1, 2, 3, 3], [2, 1, 3, 3], [3, 1, 2, 2], [1, 3, 2, 2], [2, 3, 1, 1], and [3, 2, 1, 1].
8. Count Elements with Next Element
Given an integer array arr
, count how many elements x
there are, such that x + 1
is also in arr
. If there're duplicates in arr
, count them separately.
9. 0-1 Knapsack Problem
Problem Description:
Given two integer arrays A and B of size N each which represent values and weights associated with N items respectively. Also given an integer C which represents knapsack capacity.
Find out the maximum value subset of A such that sum of the weights of this subset is smaller than or equal to C.
NOTE: You cannot break an item, either pick the complete item, or don't pick it (0-1 property).
Problem Constraints:
- 1 <= N <= 10³
- 1 <= C <= 10³
- 1 <= A[i], B[i] <= 10³
Input Format:
- First argument is an integer array A of size N denoting the values on N items.
- Second argument is an integer array B of size N denoting the weights on N items.
- Third argument is an integer C denoting the knapsack capacity.
Output Format:
Return a single integer denoting the maximum value subset of A such that sum of the weights of this subset is smaller than or equal to C.
Example Input:
Input 1:
- A = [60, 100, 120]
- B = [10, 20, 30]
- C = 50
Input 2:
- A = [10, 20, 30, 40]
- B = [12, 13, 15, 19]
- C = 10
Example Output:
Output 1: 220
Output 2: 0
10. Best Time to Buy and Sell Stock
You are given an array prices
where prices[i]
is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.
Example 1:
Input: prices = [7,1,5,3,6,4]
Output: 5
Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.
Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.
Example 2:
Input: prices = [7,6,4,3,1]
Output: 0
Explanation: In this case, no transactions are done and the max profit = 0.
Constraints:
- 1 <= prices.length <= 10⁵
- 0 <= prices[i] <= 10⁴
11. Largest Permutation
Given an integer array A of size N consisting of unique integers from 1 to N. You can swap any two integers at most B times.
Return the largest lexicographical value array that can be created by executing at most B swaps.
Problem Constraints:
- 1 <= N <= 10⁶
- 1 <= B <= 10⁹
Input Format:
- First argument is an integer array A of size N.
- Second argument is an integer B.
Output Format:
Return an integer array denoting the largest lexicographical value array that can be created by executing at most B swaps.
Example Input:
Input 1:
- A = [1, 2, 3, 4]
- B = 1
Input 2:
- A = [3, 2, 1]
- B = 2
12. Greatest Common Divisor of Strings
For two strings s and t, we say "t divides s" if and only if s = t + t + t + ... + t + t (i.e., t is concatenated with itself one or more times).
Given two strings str1
and str2
, return the largest string x such that x divides both str1
and str2
.
Example 1:
Input: str1 = "ABCABC"
, str2 = "ABC"
Output: "ABC"
Example 2:
Input: str1 = "ABABAB"
, str2 = "ABAB"
Output: "AB"
Example 3:
Input: str1 = "LEET"
, str2 = "CODE"
Output: ""
Constraints:
- 1 <= str1.length, str2.length <= 1000
- str1 and str2 consist of English uppercase letters.
DE Shaw OA Problems on LeetCode
- Best Time to Buy and Sell Stock
- Greatest Common Divisor of Strings
- Trapping Rain Water
- Reverse Nodes in k-Group
- Number of Substrings Containing All Three Characters
- Maximum Subarray
- Majority Element
- Missing Number
- Maximum Product Subarray
- Min Stack
- Intersection of Two Linked Lists
- Spiral Matrix
- Spiral Matrix II
- Number of Islands
- Course Schedule II
- Super Egg Drop
- Group Anagrams
- Best Time to Buy and Sell Stock II
- Rotate Image
- Implement Trie (Prefix Tree)
Problems on Other Platforms(GFG,InterviewBit.)
- Sum Tree
- Largest BST
- Count BST Nodes That Lie in a Given Range
- Sum of Middle Elements of Two Sorted Arrays
- Maximum Sum Rectangle
- Check Mirror in N-ary Tree
- Magic Triplets
- Water Overflow
- Count Number of Substrings
- Largest BST Subtree
- Maximum Sum Rectangle
- Sum Tree
- Largest BST
Join Telegram group for more resources & discussions!
🧰 Useful Resources for Your Placement Prep
- ✅ Free Mock Test
- ✅ ATS Score Checker & Resume Optimizer
- ✅ Previous Year Coding Questions (PYQs)
- ✅ Roadmaps
- ✅ Interview Questions
- ✅ Resume Templates
- ✅ Free Placement Materials (Google Drive)
Explore previous year questions from top companies to boost your placement prep: