Counting Subarrays and Numbers
Some D. E. Shaw problems ask only for a number, like a count of subarrays or substrings. The brute force lists every candidate and counts it, and the test sizes are chosen so that listing them times out.
The fast versions count in blocks. You fix one end and work out how many partners it has in a single step, or you fix a length and solve for the start with a line of algebra. One of the problems below turns into plain bit counting once you play it in reverse.
Write the brute force for each one anyway. You won't submit it, but it checks your fast count on small inputs, and these counts slip by one easily. Also settle the definition before you count anything. Two of these problems come in versions that disagree, one on whether equal neighbors still count as sorted and the other on which substrings get counted, so work the sample by hand first.
D. E. ShawPremium lesson · Coding round
The 4 D. E. Shaw problems are below.
- A Premium questionCoding · Hard
- A Premium questionCoding · Hard
- A Premium questionCoding · Medium
+ 1 more in this lesson
Each with hints, the follow-up and a tested solution.
Get the D. E. Shaw questions$49 a year · all 100 companies · cancel anytime
From 250 D. E. Shaw reports, forum threads behind logins and write-ups in Chinese.
D. E. Shaw interview guideKnow what D. E. Shaw asks before you walk in.
32 coding · 3 system design · 16 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.