InterviewLegend

Build From Scratch: Database, Stream Merger, Huffman & Hash Map

Alex Chen45 min readGuide updated

Two Sigma's screens like to take the library away. Instead of spotting a pattern, you build the structure yourself, in a shared pad, inside an hour. For 2026 that mostly means a Premium question. A software engineer intern was asked to build "a mini SQL db" in a January 2026 first round. An April 2026 phone screen asked for one, and a New York candidate spent a one-hour Python round in July 2026 on "a mock database class".

A January 2026 technical round asked for a class that merges delta-encoded sensor streams. A Huffman-style encoder and decoder came up on a December 2025 technical screen, and a hash map with no built-in hash table came up in screens from September to November 2025. Each one below is a runnable Python class, and its tests run in the order you'd build it.

The Two Sigma angle
A finished program isn't the only thing scored. An April 2026 candidate ran out of time on the database and said finishing wasn't required. Two Sigma's own page lists testing and design as graded areas next to coding ability. A clean create and insert, plus a select you can explain and test, beats a rushed version that half works.

Two SigmaPremium lesson · Coding round

The 4 Two Sigma problems are below.

  1. A Premium questionCoding · Hard · Frequently asked
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Two Sigma questions

$49 a year · all 107 companies · instant access

20,000+ candidate reports

Two Sigma interview guide

Know what Two Sigma asks before you walk in.

21 coding · 4 system design · 13 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

Had your Two Sigma interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.