InterviewLegend

Heaps & Intervals

Alex Chen24 min readUpdated 208 real interview reports

Two families share this lesson because both keep surfacing at TikTok, and they meet inside a single problem worth having ready before you walk in. Heaps come up whenever a round wants the smallest or largest element of a set that keeps changing, and a Premium question is the one that recurs most by name across the live coding rounds. Intervals come up a step deeper, in the harder tail: scheduling and overlap questions where you sort events and sweep through them in order. The two connect through a min-heap, which is why they sit together here.

There is no hidden TikTok twist to decode. These are canonical problems asked close to the way you already know them, so the work is fluency and finished code, not spotting a disguise. Live coding runs on Lark or Zoom, and the interviewer expects a full implementation that clears the corner cases plus a clean read of time and space cost. On a loop that puts several problems in front of you across two coding rounds and the online assessment, the habit of closing each one cleanly is what carries you through.

The TikTok angle
Premium question is the heap problem TikTok reaches for most, and it maps onto work the product does all day. The For You feed, the ranked short-video stream every user opens the app to see, is built by pulling candidate videos from many retrieval sources and merging their already-ranked outputs into one ordered list. Folding several sorted streams into a single sorted stream is exactly the problem, and the room asks it close to verbatim. Keep one pointer per list in a size-k min-heap, pop the global minimum, then push that list's next element. That runs in O(N log k) over all N nodes, and naming the bound against the naive concatenate-then-sort is part of the answer the interviewer is listening for.

TikTokPremium lesson · Coding round

The 4 TikTok problems are below.

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

+ 1 more in this lesson

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

Get the TikTok questions

$49 a year · all 100 companies · cancel anytime

From 208 TikTok reports, forum threads behind logins and write-ups in Chinese.

Had your TikTok interview?Tell us what they asked. Reviewed before it goes in, never with your name.
TikTok interview guide

Know what TikTok asks before you walk in.

20 coding · 5 system design · 18 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

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