DE Shaw
100+ Subros Interview Questions and Answers
Q1. Tower Building Problem Statement
Given an array 'ARR' of 'N' cubes, you need to construct towers such that each cube can either be placed on top of an existing tower or start a new one. The restriction is that ...read more
Q2. Rabbit Jumping Problem
Consider 'n' carrots numbered from 1 to 'n' and 'k' rabbits. Each rabbit jumps to carrots only at multiples of its respective jumping factor Aj (i.e., Aj, 2Aj, 3Aj, ...), for all rabbits ...read more
Q3. Coin Game Problem Statement
Wong wants to borrow money from Dr. Strange, who insists Wong must win a coin game first. The game involves two players taking turns to remove one coin from either end of a row of co...read more
Q4. Pretty JSON Formatting Problem
You're provided with a string 'STR' that represents a JSON object. Your task is to return an array of strings representing JSON objects, formatted with proper indentation based on...read more
Q5. Maximum Number from Linked List Problem Statement
Given a linked list where each node contains a single digit, your task is to construct the largest possible number using these digits.
Objective:
Print the maxi...read more
Q6. K Most Frequent Elements Problem Statement
Given an integer array ARR
and an integer K
, identify the K
most frequent elements within ARR
. Return these elements sorted in ascending order.
Example:
Input:
ARR = [...read more
Q7. Stock Investment Problem Statement
You are given the prices of a particular stock over 'N' consecutive days. Your task is to find the maximum profit that can be obtained by completing at most two transactions. ...read more
Q8. MegaPrime Numbers Problem Statement
Given two integers Left
and Right
, determine the count of 'megaprime' numbers within the inclusive range from 'Left' to 'Right'. A 'megaprime' number is a prime number where ...read more
Q9. Money Saving in Bank Problem
Harshit wants to save up money for his first car by depositing money daily in the Ninja bank with a specific increment strategy.
Starting with 1 rupee on the first Monday, the amoun...read more
Q10. Number Pattern Generator
To arrange a high-security meeting, tables are set up for delegates and security personnel. There are N
rows of tables. The first row has one table, the second row has two tables, and s...read more
Q11. LCS of Three Strings Problem Statement
Given three strings A, B, and C, determine the length of the longest common subsequence present in all three strings.
Explanation:
A subsequence is derived by deleting som...read more
Q12. Minimum Removals Problem Statement
Given an array ARR
of size N
and an integer K
, determine the minimum number of elements that must be removed from the array so that the difference between the maximum and mini...read more
Q13. Minimum Number of Taps to Water the Garden
Given a garden that extends along a one-dimensional x-axis from point 0 to point N, your task is to determine the minimum number of taps needed to water the entire gar...read more
Q14. Minimum Steps for a Knight to Reach Target
Given a square chessboard of size 'N x N', determine the minimum number of moves a Knight requires to reach a specified target position from its initial position.
Expl...read more
Q15. K Max Sum Combinations Problem Statement
Given two arrays/lists A
and B
, each of size N
, and an integer K
, you need to determine the K
maximum and valid sum combinations from all possible combinations of sums g...read more
Q16. Find Magic Index in Sorted Array
Given a sorted array A consisting of N integers, your task is to find the magic index in the given array, where the magic index is defined as an index i such that A[i] = i.
Exam...read more
Q17. Minimum Sum in Matrix Problem Statement
You are given a 2D matrix 'ARR' of size 'N x 3' with integers, where 'N' is the number of rows. Your task is to compute the smallest sum achievable by selecting one eleme...read more
Q18. Maximum Sum Subarray Problem Statement
Given an array of integers, find the maximum sum of any contiguous subarray within the array.
Example:
Input:
array = [34, -50, 42, 14, -5, 86]
Output:
137
Explanation:
Th...read more
Q19. Count Smaller People on Right
You are provided with an array called HEIGHT
that contains the heights of 'N' people standing in a queue. For each person in the array, compute the number of individuals on their r...read more
Q20. LCA in a Binary Search Tree
You are given a binary search tree (BST) containing N nodes. Additionally, you have references to two nodes, P and Q, within this BST.
Your task is to determine the Lowest Common Anc...read more
Q21. Problem Statement: Sibling Nodes
You are provided with a Binary Tree consisting of 'N' nodes, where each node holds an integer value. Your objective is to identify and list all nodes that do not possess a sibli...read more
Evaluate Reverse Polish Notation Problem Statement
You are provided with an arithmetic expression in Reverse Polish Notation represented as an array EXP
. Your task is to calculate the value of this expression.
Q23. Longest Increasing Path in a 2D Matrix Problem Statement
Given a matrix of non-negative integers of size 'N x M', where 'N' and 'M' denote the number of rows and columns respectively, find the length of the lon...read more
Q24. Gas Station Tour Problem
You are presented with a circular track consisting of several petrol pumps. Each petrol pump is indexed from 0 to N-1 and offers certain attributes:
- The quantity of petrol available at...read more
Q25. Conquering the Best Kingdom Problem Statement
Aragorn, an influential ruler, aspires to expand his power by conquering more kingdoms. There are 'N' kingdoms numbered from 0 to N-1, forming a tree structure. The...read more
Q26. Dijkstra's Algorithm for Shortest Path
Given an undirected graph with 'V' vertices labeled from 0 to V-1 and 'E' edges. Each edge has a weight that represents the distance between two nodes 'X' and 'Y'.
Your ta...read more
Q27. Phone Directory Search Directory
You are given a list/array of strings representing the contacts in a phone directory. The task is to perform a search based on a query string 'str' and return all contacts that ...read more
Q28. Water Equalization Problem Statement
You are provided with an array ARR
of positive integers. Each integer represents the number of liters of water in a bucket. The goal is to make the liters of water in every ...read more
Q29. Majority Element - II Problem Statement
You are given an array ARR
of integers of length N
. Your task is to find all the elements that occur strictly more than floor(N/3)
times in the given array.
Input:
The fi...read more
Q30. Buy and Sell Stock Problem Statement
Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more
Q31. Find Triplets with Given Sum Problem Statement
Given an array ARR
consisting of N
integers, your task is to identify all distinct triplets within the array that sum up to a given integer K
.
Explanation:
An arra...read more
Q32. Next Higher and Previous Lower Number with Same Number of Set Bits
Given a positive integer n
, the task is to find the next smallest integer and the previous largest integer that contain the exact same number o...read more
Q33. Minimum Number of Platforms Problem
Your task is to determine the minimum number of platforms required at a railway station so that no train has to wait.
Explanation:
Given two arrays:
AT
- representing the ar...read more
Q34. Peak Element Finder
For a given array of integers arr
, identify the peak element. A peak element is an element that is greater than its neighboring elements. Specifically, if arr[i]
is the peak, then both arr[i...read more
Q35. Bottom View of Binary Tree
Given a binary tree, determine and return its bottom view when viewed from left to right. Assume that each child of a node is positioned at a 45-degree angle from its parent.
Nodes in...read more
Q36. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
Q37. Binary Tree Mirror Conversion Problem
Given a binary tree, your task is to convert it into its mirror tree.
A binary tree is a data structure where each parent node has at most two children.
The mirror of a bin...read more
Q38. Find the Largest BST Subtree in a Given Binary Tree
Your task is to determine the size of the largest subtree of a given binary tree which is also a Binary Search Tree (BST).
BST Definition:
- The left subtree o...read more
Q39. Jump Game Problem Statement
In this problem, you are given an array ARR
consisting of N
integers. Your task is to determine the minimum number of jumps required to reach the last index of the array N - 1
. At an...read more
Q40. Alien Dictionary Problem Statement
You are provided with a sorted dictionary (by lexical order) in an alien language. Your task is to determine the character order of the alien language from this dictionary. Th...read more
Q41. Longest Common Subsequence of Three Strings
Given three strings A, B, and C, the task is to determine the length of the longest common subsequence across these three strings.
Explanation:
A subsequence of a str...read more
Q42. Delete a Node from a Linked List
You are provided with a linked list of integers. Your task is to implement a function that deletes a node located at a specified position 'POS'.
Input:
The first line contains a...read more
Q43. Reverse Linked List Problem Statement
Given a singly linked list of integers, return the head of the reversed linked list.
Example:
Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Q44. Minimum Fountains Activation Problem
In this problem, you have a one-dimensional garden of length 'N'. Each position from 0 to 'N' has a fountain that can provide water to the garden up to a certain range. Thus...read more
Q45. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
Q46. Chocolate Distribution Problem
You are given an array/list CHOCOLATES
of size 'N', where each element represents the number of chocolates in a packet. Your task is to distribute these chocolates among 'M' stude...read more
Q47. Ways to Arrange Balls Problem
You are given 'a' balls of type 'A', 'b' balls of type 'B', and 'c' balls of type 'C'. Determine the total number of ways to arrange these balls in a straight line so that no two a...read more
Q48. Check if Binary Search Tree (BST)
Given a binary tree with 'N' nodes, verify whether this tree is a Binary Search Tree (BST). Return true if it is a BST and false otherwise.
Definition:
A Binary Search Tree (BS...read more
Q49. Find the Lone Set Bit
Your task is to identify the position of the only '1' bit in the binary representation of a given non-negative integer N
. The representation contains exactly one '1' and the rest are '0's....read more
Q50. Validate BST Problem Statement
Given a binary tree with N
nodes, determine whether the tree is a Binary Search Tree (BST). If it is a BST, return true
; otherwise, return false
.
A binary search tree (BST) is a b...read more
Q51. Is Binary Heap Tree Problem Statement
You are given a binary tree of integers. Your task is to determine if it is a binary heap tree or not.
Input:
The first line of input contains an integer ‘T’ denoting the n...read more
Q52. Best Time To Buy and Sell Stock Problem Statement
You are given an array 'PRICES' of 'N' integers, where 'PRICES[i]' represents the price of a certain stock on the i-th day. An integer 'K' is also provided, ind...read more
Q53. Pythagorean Triplets Detection
Determine if an array contains a Pythagorean triplet by checking whether there are three integers x, y, and z such that x2 + y2 = z2 within the array.
Input:
The first line contai...read more
Q54. Candies Distribution Problem Statement
Prateek is a kindergarten teacher with a mission to distribute candies to students based on their performance. Each student must get at least one candy, and if two student...read more
Q55. Validate Binary Search Tree (BST)
You are given a binary tree with 'N' integer nodes. Your task is to determine whether this binary tree is a Binary Search Tree (BST).
BST Definition:
A Binary Search Tree (BST)...read more
Q56. Two cops and a robber are located on opposite corners of a cube and move along its edges. They all move at the same rate. Is it possible for the cops to catch the robber. [Each of the 3 people can see each othe...
read moreNo, it is not possible for the cops to catch the robber.
The robber can always stay equidistant from the cops by moving along the diagonal of the cube.
The cops can never cut off the robber's path without colliding with each other.
This problem is known as the '3 Cops and a Robber' problem in graph theory.
Q57. Find the Duplicate Number Problem Statement
Given an integer array 'ARR' of size 'N' containing numbers from 0 to (N - 2). Each number appears at least once, and there is one number that appears twice. Your tas...read more
Q58. First Negative Integer in Every Window of Size K
Given an array of integers 'ARR' and an integer 'K', determine the first negative integer in every contiguous subarray (or window) of size 'K'. If a window does ...read more
Q59. Candy Distribution Problem Statement
Prateek, a kindergarten teacher, needs to distribute candies to his class. Each child has a performance grade, and all students stand in a line.
The rules for distributing c...read more
Q60. Inorder Traversal of Binary Tree Without Recursion
Given a Binary Tree consisting of 'N' nodes with integer values, your task is to perform an In-Order traversal of the tree without using recursion.
Input:
The ...read more
Q61. Union and Intersection of Two Arrays
Given two arrays 'A' and 'B' of size 'N' and 'M' respectively, both sorted in non-decreasing order, find the intersection of these two arrays.
The intersection of two arrays...read more
Q62. Longest Increasing Subsequence Problem Statement
Given 'N' students standing in a row with specific heights, your task is to find the length of the longest strictly increasing subsequence of their heights, ensu...read more
Q63. Find the Missing Number in an Arithmetic Progression
You are given a sorted array consisting of ‘N’ distinct integers, forming a nearly complete Arithmetic Progression, except for one missing element. Your task...read more
Q64. Time to Burn Tree Problem
You are given a binary tree consisting of 'N' unique nodes and a start node where the burning will commence. The task is to calculate the time in minutes required to completely burn th...read more
Q65. In some tournament 139 teams have participated. Tournament is knock out. what is the number of matches to choose the champion to be held?
139 teams in a knock-out tournament, find the number of matches to choose the champion.
In a knock-out tournament, each team plays only one match per round.
The number of matches required to choose the champion is one less than the number of teams.
Therefore, the number of matches required is 138.
Q66. Binary Ones Count Problem
Develop a program to determine the number of '1's in the binary form of a given integer.
Input:
The input consists of a single line containing an integer N.
Output:
The output should b...read more
Q67. Equalize Water in Buckets
You are provided with an array, ARR
, of positive integers. Each integer represents the number of liters of water in a bucket. The goal is to make the water volume in each bucket equal ...read more
Q69. What is the difference between default and copy constructor?
Default constructor is provided by the compiler if no constructor is defined. Copy constructor creates a new object by copying an existing object.
Default constructor initializes member variables to default values.
Copy constructor creates a new object with the same values as an existing object.
Default constructor is called automatically by the compiler if no constructor is defined.
Copy constructor is called when an object is passed by value or when a new object is initialized ...read more
Q70. What is the difference between primary key and unique key?
Primary key uniquely identifies a record in a table, while unique key ensures that all values in a column are distinct.
Primary key can't have null values, while unique key can have one null value.
A table can have only one primary key, but multiple unique keys.
Primary key is used as a foreign key in other tables, while unique key is not.
Example: Primary key - employee ID, Unique key - email address.
Q71. What is the difference between Truncate and Delete?
Truncate removes all data from a table while Delete removes specific data from a table.
Truncate is faster than Delete as it doesn't log individual row deletions.
Truncate resets the identity of the table while Delete doesn't.
Truncate can't be rolled back while Delete can be.
Truncate doesn't fire triggers while Delete does.
Q72. Write an algorithm to find the absolute max subsequence of an array containing both positive and negative numbers in O(n) time ?
Algorithm to find absolute max subsequence of an array with positive and negative numbers in O(n) time.
Initialize max_so_far and max_ending_here as 0
Loop through the array and for each element, add it to max_ending_here
If max_ending_here becomes negative, reset it to 0
If max_ending_here is greater than max_so_far, update max_so_far
Return max_so_far
Q75. Design a class which has director, HOD, Professor and students. They all are reporting to their respective heads. I have to display the hierarchy structure of the information in a Site
Design a class hierarchy for director, HOD, Professor and students reporting to their respective heads.
Create a base class for all employees with common attributes and methods
Create derived classes for director, HOD, Professor and students
Implement reporting hierarchy using pointers or references
Display hierarchy structure on the site using a tree or graph
Consider adding additional attributes and methods as needed
Q76. What is the difference between C and C++?
C++ is an extension of C with object-oriented programming features.
C++ supports classes and objects while C does not.
C++ has better support for polymorphism and inheritance.
C++ has a standard template library (STL) which C does not have.
C++ allows function overloading while C does not.
C++ has exception handling while C does not.
Q78. Find the next largest int of a given int such that it has same number of 1′s in binary?
Find the next largest int with same number of 1's in binary.
Count the number of 1's in the binary representation of the given int.
Increment the given int until a number with the same number of 1's is found.
Return the next largest int with same number of 1's.
Q79. What is the difference between DML and DLL?
DML is Data Manipulation Language used to manipulate data in a database. DLL is Data Definition Language used to define database schema.
DML is used to insert, update, delete data in a database.
DLL is used to create, alter, drop database objects like tables, views, indexes.
DML statements include INSERT, UPDATE, DELETE.
DLL statements include CREATE, ALTER, DROP.
DML affects data in a database, DLL affects the structure of a database.
Q80. What is the difference between DBMS and RDBMs?
DBMS is a software system to manage databases while RDBMS is a type of DBMS that uses a relational model.
DBMS stands for Database Management System while RDBMS stands for Relational Database Management System.
DBMS can manage any type of database while RDBMS uses a relational model to manage data.
DBMS does not enforce any specific data model while RDBMS enforces a relational data model.
Examples of DBMS include MongoDB, Cassandra, and Redis while examples of RDBMS include MySQL...read more
Q81. task schedular from leetcode second is : N piles of coins diffrent length you can add or remove one coin from a pile adding cost c1 and removing cost c2 find minimum cost such that height of n piles equals
Find minimum cost to make heights of N piles of coins equal by adding or removing one coin from a pile with different costs.
Use dynamic programming to keep track of the minimum cost for each pile height.
Consider the cost of adding and removing coins from each pile.
Iterate through all possible combinations of adding and removing coins to find the minimum cost.
Q82. Given an array eliminate the duplicates and print it. Linear time complexity?
Eliminate duplicates in an array of strings and print it in linear time complexity.
Use a hash set to keep track of unique elements
Iterate through the array and add non-duplicate elements to the hash set
Print the hash set elements to get the final array
Q83. Mention any five operating systems which have been derived from UNIX
Five operating systems derived from UNIX are...
Linux
macOS
Solaris
FreeBSD
Android
Q88. do you think the era of social media influencers is short lived?
No, social media influencers are here to stay.
Social media has become an integral part of our lives and will continue to be so.
Influencers have a huge impact on consumer behavior and brand marketing.
The industry is constantly evolving and adapting to changes.
Influencers are diversifying their content and expanding their reach.
Brands are investing more in influencer marketing than ever before.
Examples: Kylie Jenner, PewDiePie, Huda Kattan, etc.
Q89. What is the purpose of Normalisation?
Normalisation is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalisation helps to eliminate data redundancy and inconsistencies
It ensures that each piece of data is stored in only one place
It helps to improve data integrity and accuracy
It makes it easier to maintain and update the database
There are different levels of normalisation, each with its own set of rules and guidelines
Q90. How would I defend myself if I were to get caught for having downloaded torrents?
Defending oneself for downloading torrents
Explain that downloading torrents is illegal but common
Admit to the mistake and show remorse
Explain that you were not aware of the consequences
Promise to delete all downloaded content and not repeat the mistake
Offer to pay any fines or penalties
Consult a lawyer for legal advice
Q94. What are class access modifiers?
Class access modifiers are keywords used to control the visibility and accessibility of class members.
There are four access modifiers in Java: public, private, protected, and default
Public members can be accessed from anywhere
Private members can only be accessed within the same class
Protected members can be accessed within the same class, subclasses, and same package
Default members can be accessed within the same package
Q96. Throw some light on what is happening inside Large Hadron Collider in CERN
The Large Hadron Collider is a particle accelerator used to study the smallest known particles and their interactions.
The LHC is a circular tunnel located underground in Switzerland and France.
It accelerates particles to nearly the speed of light and then collides them together.
Scientists study the debris from these collisions to learn about the fundamental building blocks of the universe.
The LHC has been used to discover the Higgs boson particle and search for evidence of da...read more
Q97. find maximum length BST in a given binary tree?
To find the maximum length BST in a given binary tree.
Traverse the tree in post-order fashion
For each node, check if it satisfies the BST property
If it does, calculate the size of the BST rooted at that node
Keep track of the maximum size seen so far
Q98. DP Hard ( Minimum Steps to Delete a String by deleting substring comprising of same characters - GFG)
The problem involves finding the minimum steps to delete a substring comprising of same characters from a given string.
Use dynamic programming to keep track of the minimum steps required to delete substrings.
Iterate through the string and check for substrings with same characters.
Update the DP array with the minimum steps required to delete the substring.
Q99. Which Technology is Used by DE shaw for investments?
DE Shaw uses a combination of proprietary technology and algorithms for investments.
DE Shaw utilizes advanced quantitative models and machine learning algorithms for investment decisions.
They have developed their own trading platform and software tools to analyze market data and execute trades efficiently.
The firm also leverages big data analytics and high-frequency trading strategies to gain a competitive edge in the market.
Q100. Write algo to mirror a given Binary Tree?
Algorithm to mirror a given Binary Tree
Create a function to swap left and right child nodes of a given node
Recursively call the function on left and right child nodes
Base case: if node is null, return
Call the function on the root node of the binary tree
More about working at DE Shaw
Top HR Questions asked in Subros
Interview Process at Subros
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month