Problem database last updated: June 20, 2025

DDE Shaw logo

DE Shaw Coding Interview Questions

96 problems · 10 Easy, 55 Medium, 31 Hard · Ranked #17 of 458

Difficulty breakdown

10 Easy

10% · avg 23%

55 Medium

57% · avg 59%

31 Hard

32% · avg 18%

Top topics

array
74%
dynamic-programming
35.4%1.8x
greedy
19.8%2.3x
string
19.8%
sorting
18.8%
hash-table
17.7%

Interview profile

Based on 96 reported problems, DE Shaw interviews are significantly harder than average - 32% Hard vs 18% across all companies. The majority (57%) of questions are Medium difficulty, which is typical for companies that want to see solid fundamentals without excessive trick questions.

Compared to the industry average, DE Shaw puts unusual emphasis on combinatorics (2.1% of problems, 3.7x the industry average), prefix-sum (9.4% of problems, 2.8x the industry average), enumeration (2.1% of problems, 2.5x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (74%), dynamic-programming (35.4%), greedy (19.8%), string (19.8%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 96 problems

Binary Tree Cameras

Solve

You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate chil...

HardVery Likely
dynamic-programmingtreedepth-first-search

Minimum Size Subarray in Infinite Array

Solve

You are given a 0-indexed array nums and an integer target.

MediumVery Likely
arrayhash-tablesliding-window

Removing Minimum Number of Magic Beans

Solve

You are given an array of positive integers beans, where each integer represents the number of magic beans found in a particular magic bag.

MediumVery Likely
arraygreedysorting

Maximum Subsequence Score

Solve

You are given two 0-indexed integer arrays nums1 and nums2 of equal length n and a positive integer k. You must choose a subsequence of indices from nums1 of le...

MediumVery Likely
arraygreedysorting

Relative Sort Array

Solve

Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.

EasyVery Likely
arrayhash-tablesorting

Sum Game

Solve

Alice and Bob take turns playing a game, with Alice starting first.

MediumVery Likely
mathstringgreedy

Minimum Cost Walk in Weighted Graph

Solve

There is an undirected weighted graph with n vertices labeled from 0 to n - 1.

HardVery Likely
arraybit-manipulationunion-find

Max Number of K-Sum Pairs

Solve

You are given an integer array nums and an integer k.

MediumVery Likely
arrayhash-tabletwo-pointers

Maximum Points After Collecting Coins From All Nodes

Solve

There exists an undirected tree rooted at node 0 with n nodes labeled from 0 to n - 1. You are given a 2D integer array edges of length n - 1, where edges[i] =...

HardVery Likely
arraydynamic-programmingbit-manipulation

Letter Combinations of a Phone Number

Solve

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

MediumVery Likely
hash-tablestringbacktracking

Maximum Points Tourist Can Earn

Solve

A tourist is visiting a country with n cities, where each city is directly connected to every other city. The tourist's journey consists of exactly k 0-indexed...

MediumVery Likely
arraydynamic-programmingmatrix

Maximum Strength of K Disjoint Subarrays

Solve

You are given an array of integers nums with length n, and a positive odd integer k.

HardVery Likely
arraydynamic-programmingprefix-sum

Shortest String That Contains Three Strings

Solve

Given three strings a, b, and c, your task is to find a string that has the minimum length and contains all three strings as substrings. If there are multiple s...

MediumVery Likely
stringgreedyenumeration

Take Gifts From the Richest Pile

Solve

You are given an integer array gifts denoting the number of gifts in various piles. Every second, you do the following:

EasyVery Likely
arrayheap-priority-queuesimulation

Maximum Deletions on a String

Solve

You are given a string s consisting of only lowercase English letters. In one operation, you can:

HardVery Likely
stringdynamic-programmingrolling-hash

Equal Row and Column Pairs

Solve

Given a 0-indexed n x n integer matrix grid, return the number of pairs (ri, cj) such that row ri and column cj are equal.

MediumVery Likely
arrayhash-tablematrix

Query Kth Smallest Trimmed Number

Solve

You are given a 0-indexed array of strings nums, where each string is of equal length and consists of only digits.

MediumVery Likely
arraystringdivide-and-conquer

Find the Maximum Divisibility Score

Solve

You are given two integer arrays nums and divisors.

EasyVery Likely
array

Determine the Winner of a Bowling Game

Solve

You are given two 0-indexed integer arrays player1 and player2, representing the number of pins that player 1 and player 2 hit in a bowling game, respectively.

EasyVery Likely
arraysimulation

Greatest Sum Divisible by Three

Solve

Given an integer array nums, return the maximum possible sum of elements of the array such that it is divisible by three.

MediumVery Likely
arraydynamic-programminggreedy

Minimum Deletions to Make String K-Special

Solve

You are given a string word and an integer k.

MediumVery Likely
hash-tablestringgreedy

Find the Sum of the Power of All Subsequences

Solve

You are given an integer array nums of length n and a positive integer k.

HardVery Likely
arraydynamic-programming

Number of Substrings Containing All Three Characters

Solve

Given a string s consisting only of characters a, b and c.

MediumVery Likely
hash-tablestringsliding-window

Number of Subarrays With AND Value of K

Solve

Given an array of integers nums and an integer k, return the number of subarrays of nums where the bitwise AND of the elements of the subarray equals k.

HardVery Likely
arraybinary-searchbit-manipulation

Count the Number of Incremovable Subarrays II

Solve

You are given a 0-indexed array of positive integers nums.

HardLikely
arraytwo-pointersbinary-search

K-th Smallest in Lexicographical Order

Solve

Given two integers n and k, return the kth lexicographically smallest integer in the range [1, n].

HardLikely
trie

Majority Element

Solve

Given an array nums of size n, return the majority element.

EasyLikely
arrayhash-tabledivide-and-conquer

Painting the Walls

Solve

You are given two 0-indexed integer arrays, cost and time, of size n representing the costs and the time taken to paint n different walls respectively. There ar...

HardLikely
arraydynamic-programming

Best Time to Buy and Sell Stock

Solve

You are given an array prices where prices[i] is the price of a given stock on the ith day.

EasyLikely
arraydynamic-programming

Minimum Number of Refueling Stops

Solve

A car travels from a starting position to a destination which is target miles east of the starting position.

HardLikely
arraydynamic-programminggreedy

Minimum Number of Taps to Open to Water a Garden

Solve

There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e., the length of the garden is n).

HardLikely
arraydynamic-programminggreedy

House Robber

Solve

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob...

MediumLikely
arraydynamic-programming

Sliding Window Maximum

Solve

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see...

HardLikely
arrayqueuesliding-window

Best Time to Buy and Sell Stock II

Solve

You are given an integer array prices where prices[i] is the price of a given stock on the ith day.

MediumLikely
arraydynamic-programminggreedy

Put Marbles in Bags

Solve

You have k bags. You are given a 0-indexed integer array weights where weights[i] is the weight of the ith marble. You are also given the integer k.

HardLikely
arraygreedysorting

Maximum Product Subarray

Solve

Given an integer array nums, find a subarray that has the largest product, and return the product.

MediumLikely
arraydynamic-programming

Insert Delete GetRandom O(1)

Solve

Implement the RandomizedSet class:

MediumLikely
arrayhash-tablemath

Maximum Subarray

Solve

Given an integer array nums, find the subarray with the largest sum, and return its sum.

MediumLikely
arraydivide-and-conquerdynamic-programming

Remove K Digits

Solve

Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.

MediumLikely
stringstackgreedy

Longest Consecutive Sequence

Solve

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

MediumLikely
arrayhash-tableunion-find

Maximal Square

Solve

Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.

MediumLikely
arraydynamic-programmingmatrix

Min Cost to Connect All Points

Solve

You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].

MediumSometimes
arrayunion-findgraph

Find First and Last Position of Element in Sorted Array

Solve

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

MediumSometimes
arraybinary-search

Koko Eating Bananas

Solve

Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours.

MediumSometimes
arraybinary-search

Unique Paths

Solve

There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner...

MediumSometimes
mathdynamic-programmingcombinatorics

Basic Calculator II

Solve

Given a string s which represents an expression, evaluate this expression and return its value.

MediumSometimes
mathstringstack

Trapping Rain Water

Solve

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

HardSometimes
arraytwo-pointersdynamic-programming

Generate Parentheses

Solve

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

MediumSometimes
stringdynamic-programmingbacktracking

Jump Game II

Solve

You are given a 0-indexed array of integers nums of length n. You are initially positioned at index 0.

MediumSometimes
arraydynamic-programminggreedy

Find the Smallest Divisor Given a Threshold

Solve

Given an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division's result....

MediumSometimes
arraybinary-search

Heaters

Solve

Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses.

MediumSometimes
arraytwo-pointersbinary-search

Split Array Largest Sum

Solve

Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized.

HardSometimes
arraybinary-searchdynamic-programming

Maximum Performance of a Team

Solve

You are given two integers n and k and two integer arrays speed and efficiency both of length n. There are n engineers numbered from 1 to n. speed[i] and effici...

HardSometimes
arraygreedysorting

Minimum Number of Pushes to Type Word II

Solve

You are given a string word containing lowercase English letters.

MediumSometimes
hash-tablestringgreedy

Swim in Rising Water

Solve

You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j).

HardSometimes
arraybinary-searchdepth-first-search

Number of Wonderful Substrings

Solve

A wonderful string is a string where at most one letter appears an odd number of times.

MediumSometimes
hash-tablestringbit-manipulation

Task Scheduler

Solve

You are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be idle or allow the completion of one task....

MediumSometimes
arrayhash-tablegreedy

Average Waiting Time

Solve

There is a restaurant with a single chef. You are given an array customers, where customers[i] = [arrivali, timei]:

MediumSometimes
arraysimulation

Furthest Building You Can Reach

Solve

You are given an integer array heights representing the heights of buildings, some bricks, and some ladders.

MediumSometimes
arraygreedyheap-priority-queue

Shortest Subarray to be Removed to Make Array Sorted

Solve

Given an integer array arr, remove a subarray (can be empty) from arr such that the remaining elements in arr are non-decreasing.

MediumSometimes
arraytwo-pointersbinary-search

Maximum Profit in Job Scheduling

Solve

We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].

HardSometimes
arraybinary-searchdynamic-programming

Maximal Rectangle

Solve

Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.

HardSometimes
arraydynamic-programmingstack

Combination Sum

Solve

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum...

MediumSometimes
arraybacktracking

Triangle

Solve

Given a triangle array, return the minimum path sum from top to bottom.

MediumSometimes
arraydynamic-programming

Longest Valid Parentheses

Solve

Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring.

HardSometimes
stringdynamic-programmingstack

4Sum

Solve

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:

MediumSometimes
arraytwo-pointerssorting

Largest Rectangle in Histogram

Solve

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the his...

HardSometimes
arraystackmonotonic-stack

Reverse Nodes in k-Group

Solve

Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.

HardSometimes
linked-listrecursion

Sort Colors

Solve

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order...

MediumSometimes
arraytwo-pointerssorting

Median of Two Sorted Arrays

Solve

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

HardSometimes
arraybinary-searchdivide-and-conquer

Peak Index in a Mountain Array

Solve

You are given an integer mountain array arr of length n where the values increase to a peak element and then decrease.

MediumSometimes
arraybinary-search

Contains Duplicate

Solve

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.

EasySometimes
arrayhash-tablesorting

Next Permutation

Solve

A permutation of an array of integers is an arrangement of its members into a sequence or linear order.

MediumSometimes
arraytwo-pointers

Edit Distance

Solve

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

MediumSometimes
stringdynamic-programming

Valid Parentheses

Solve

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

EasySometimes
stringstack

Merge Intervals

Solve

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...

MediumSometimes
arraysorting

Spiral Matrix

Solve

Given an m x n matrix, return all elements of the matrix in spiral order.

MediumSometimes
arraymatrixsimulation

Number of Ways to Reorder Array to Get Same BST

Solve

Given an array nums that represents a permutation of integers from 1 to n. We are going to construct a binary search tree (BST) by inserting the elements of num...

HardSometimes
arraymathdivide-and-conquer

Minimum Number of Visited Cells in a Grid

Solve

You are given a 0-indexed m x n integer matrix grid. Your initial position is at the top-left cell (0, 0).

HardSometimes
arraydynamic-programmingstack

Largest 1-Bordered Square

Solve

Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has all 1s on its border, or 0 if such a subgrid doesn't exist in...

MediumSometimes
arraydynamic-programmingmatrix

Implement Stack using Queues

Solve

Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and...

EasySometimes
stackdesignqueue

Max Sum of Rectangle No Larger Than K

Solve

Given an m x n matrix matrix and an integer k, return the max sum of a rectangle in the matrix such that its sum is no larger than k.

HardSometimes
arraybinary-searchmatrix

Make Costs of Paths Equal in a Binary Tree

Solve

You are given an integer n representing the number of nodes in a perfect binary tree consisting of nodes numbered from 1 to n. The root of the tree is node 1 an...

MediumSometimes
arraydynamic-programminggreedy

Rotate Image

Solve

You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).

MediumSometimes
arraymathmatrix

All Nodes Distance K in Binary Tree

Solve

Given the root of a binary tree, the value of a target node target, and an integer k, return an array of the values of all nodes that have a distance k from the...

MediumSometimes
hash-tabletreedepth-first-search

Find the Shortest Superstring

Solve

Given an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of the smalle...

HardSometimes
arraystringdynamic-programming

Maximum OR

Solve

You are given a 0-indexed integer array nums of length n and an integer k. In an operation, you can choose an element and multiply it by 2.

MediumSometimes
arraygreedybit-manipulation

Kth Smallest Number in Multiplication Table

Solve

Nearly everyone has used the Multiplication Table. The multiplication table of size m x n is an integer matrix mat where mat[i][j] == i j (1-indexed).

HardSometimes
mathbinary-search

Maximum Points You Can Obtain from Cards

Solve

There are several cards arranged in a row, and each card has an associated number of points. The points are given in the integer array cardPoints.

MediumSometimes
arraysliding-windowprefix-sum

Longest Increasing Path in a Matrix

Solve

Given an m x n integers matrix, return the length of the longest increasing path in matrix.

HardSometimes
arraydynamic-programmingdepth-first-search

Open the Lock

Solve

You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely...

MediumSometimes
arrayhash-tablestring

Minimum Size Subarray Sum

Solve

Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If...

MediumSometimes
arraybinary-searchsliding-window

Linked List Cycle

Solve

Given head, the head of a linked list, determine if the linked list has a cycle in it.

EasySometimes
hash-tablelinked-listtwo-pointers

Basic Calculator

Solve

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

HardSometimes
mathstringstack

Interleaving String

Solve

Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.

MediumSometimes
stringdynamic-programming

Cheapest Flights Within K Stops

Solve

There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight...

MediumSometimes
dynamic-programmingdepth-first-searchbreadth-first-search

How often are these problems asked?

Frequency scores are based on crowdsourced interview reports. A higher score means the problem has been reported more often in recent DE Shaw interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your DE Shaw coding interview

DE Shaw interviews focus heavily on array, dynamic-programming, greedy problems. If you're short on time, these are the categories to prioritize. The problems on this page are sorted by frequency, so start from the top and work your way down.

Beyond solving problems, practice explaining your approach. DE Shaw interviewers care about your thought process - how you break down a problem, consider edge cases, and evaluate tradeoffs between solutions. A clean O(n) solution you can explain clearly beats an O(log n) solution you can't articulate.

Looking for more companies? Browse all 458 companies in our directory, or sharpen your fundamentals with our free data structure visualizers and AI-powered DSA tutor.

Frequently Asked Questions

What coding problems does DE Shaw ask in interviews?add

DE Shaw has been reported to ask 96 distinct coding problems. The most common topics are array, dynamic-programming, greedy. 10 are Easy difficulty, 55 are Medium, and 31 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are DE Shaw coding interviews?add

Based on 96 reported problems, DE Shaw interviews are significantly harder than average - 32% Hard vs 18% across all companies. 57% of questions are Medium difficulty. Focus on the high-frequency Medium problems first, then work through the Hard ones.

How should I prepare for a DE Shaw coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, dynamic-programming, greedy. Practice solving them under time pressure and explaining your approach out loud. Mock interviews with AI can simulate the real experience.

Other companies to explore

Ready to ace your DE Shaw interview?

Simulate a real DE Shaw coding interview with an AI interviewer. Get a scorecard with specific feedback on your problem-solving, code quality, and communication.

Simulate a DE Shaw interview with AIarrow_forward