Study
Sorting Interview Questions: Meeting Rooms, Top-K and Dedup
TrueInterview
October 26, 2026 · 17 min read

As of 2026-10-26, TrueInterview's bank holds 102 candidate-reported sorting questions from 24 big-tech companies, and most of the heavily linked ones never say sort in their titles. File Deduplication leads with 13 candidate write-ups, ahead of Meeting Rooms with 9 and Distributed Mode and Median with 8. Phone screens carry most of the reports: 59 questions were reported there, against 30 onsite and 20 in online assessments. Prepare by learning to spot when ordering unlocks a problem and by using your language's built-in sort correctly, rather than by memorising textbook algorithms.
Disclosure: TrueInterview is an interview-preparation product and publishes this article. Facts about other products come from their public pages on the dates listed under Sources.
Which sorting questions do candidates report most?
The most-linked questions are product-shaped tasks, and only one of the top rows names an algorithm: Kth Largest Element / Quick Select. The table groups each question by the technique we read in its title. That grouping is our editorial reading, not a tag the bank stores, and every row carries the sorting tag because the set was selected by it.

| Question | Technique inside (our reading of the title) | Write-up links | Example report | Practise |
|---|---|---|---|---|
| File Deduplication | Group by key, then dedup | 13, all from Anthropic | Anthropic OA, 2026-09 | File Deduplication |
| Meeting Rooms | Sort by start, then sweep | 9, from Amazon, Netflix and Uber | Uber phone screen, 2026-09 | Meeting Rooms |
| Distributed Mode and Median | Order statistics over split data | 8, all from Anthropic | Distributed Mode and Median | |
| Kth Largest Element / Quick Select | Top-k and quickselect | 7, from ByteDance and Meta | Meta phone screen, 2026-07 | Kth Largest Element / Quick Select |
| Mining Block | Not clear from the title; read the statement | 7, all from Coinbase | Coinbase onsite, 2026-05 | Mining Block |
| DAG Allow / Disallow Propagation | Ordering over a graph | 7, all from Snowflake | Snowflake phone screen, 2026-09 | DAG Allow / Disallow Propagation |
| Dependency Version Check | Custom comparator on versions | 5, all from OpenAI | OpenAI phone screen, 2026-05 | Dependency Version Check |
| Find the Top 10 Most Frequent IP Addresses | Count, then rank | 5, all from Amazon | Amazon phone screen, 2026-09 | Most frequent IP addresses |
| Employee Shift Timeline Table | Sort by time, then sweep | 3 | Google onsite, 2026-09 | Employee Shift Timeline Table |
| Split Stay Booking | Intervals over dates | 3 senior-or-above and 1 junior-or-below | Airbnb phone screen, 2026-02 | Split Stay Booking |
| Minimum Sum-of-Distances Meeting Point on a Line | Sort, then take the median | 4 from senior-or-above write-ups | LinkedIn phone screen, 2026-02 | Meeting point on a line |
Write-up links measure what candidates wrote up, not how often a company asks a question, and these are candidate-reported questions reconstructed for practice rather than any company's official list. One write-up can link more than one question, so the link counts do not add up to distinct candidates. The second column is our reading of each title, not the problem statement, so open the practice page before you commit to a technique.
Our take: the shape of the table matters more than any single row. Almost every title names a task, such as deduplicating files, booking rooms or checking versions, and the sort is a step you have to notice yourself. Your interviewer will not tell you to sort. The prompt asks for a schedule, a ranking or a set without duplicates, and your first decision is what to order by and how to break ties.
Which questions hide the ordering step?
In the table above, none of the titles uses the word sort, and all but Kth Largest Element / Quick Select describe a task rather than an algorithm. Across the 102 questions, the companion tags that travel with sorting most often are hashing (20), greedy (15), intervals (14), arrays (14) and heap (8), with graphs on 6. Those tags tell you where the hidden sort usually sits: after a count, before a sweep, or inside a selection. The reported titles fall into five shapes.
Schedules and timelines
Meeting Rooms, Employee Shift Timeline Table and Split Stay Booking read as scheduling tasks. In our reading, each needs its events ordered by time before anything else works. The classic Meeting Rooms solution sorts meetings by start time and compares each start with the previous end. The minimum-rooms variant either sorts starts and ends separately and walks both lists, or keeps a min-heap of end times. Both cost O(n log n), dominated by the sort, so check which variant the bank's version asks before you code.
Count, then rank: top-k and quickselect
The Amazon IP-frequency question and Kth Largest Element / Quick Select are the reported top-k problems. The standard move is a hash map of counts followed by one of three ranking steps: a full sort in O(n log n), a min-heap capped at k entries in O(n log k), or quickselect in average linear time. When k is a small fixed number, as the Amazon title suggests, the capped heap avoids sorting every distinct key. Kth Largest Element / Quick Select is the visible exception to the hidden-sort pattern: the selection algorithm is the subject, so expect to partition by hand.
Group by key, then dedup
File Deduplication is the most-linked title, and the statement decides what makes two records duplicates. Two general tools apply to any deduplication task. A hash map from key to group finds duplicates in one pass with extra memory. A sort places equal keys next to each other, so one linear pass finds them with less extra memory. Mention the sort version if the interviewer asks what happens when the map no longer fits in memory.
Custom comparators and version order
Dependency Version Check is the clearest comparator candidate by title. If the statement asks you to compare version strings, which the title suggests but only the statement confirms, compare dot-separated segments as numbers rather than as text, because text comparison ranks a segment of ten below a segment of nine. If the statement treats a missing segment as zero, pad the shorter version before you compare.
Merged inputs and split data
Distributed Mode and Median and Shard Rebalancing have titles that point at data spread across machines. We do not know their statements, so treat this as general engineering knowledge. Sorted runs from several machines combine with a k-way merge over a heap in O(n log k). A median over split data is cheaper to compute from per-machine counts or histograms than from shipped raw values, and a mode combines per-machine frequency maps. Find Median In Large Array belongs to the same family, filed under 3 big-tech companies but linked from 1 write-up.
Is the famous list the one candidates report?
Only partly: the famous problems are filed widely but rarely linked from write-ups, while the most-linked questions are product-shaped tasks at one or two companies. Merge Intervals is filed under 12 big-tech companies in the bank, yet it is linked from 0 candidate write-ups. Top K Frequent Elements is filed under 6 companies and linked from 1 write-up. File Deduplication, at a single company, is linked from 13.
The two counts measure different things. Company filings show how many companies a question has been reported at, and write-up links show how many collected interview write-ups point to it. Zero links does not mean Merge Intervals is never asked; it means no write-up in the bank points to it.
Our take: cover both lists, in proportion. Solve Merge Intervals and Top K Frequent Elements once each, because they are the base patterns under Meeting Rooms and the IP-frequency question. Then move most of your sorting time to the titles that write-ups at your target company actually link. A famous problem you can already solve earns you little extra practice value; a reported product-shaped task you have never seen earns a lot.
Which round should you prepare for first?
The phone screen. Of the reported rounds, 59 sorting questions came from phone screens, 30 from onsites and 20 from online assessments, and a question can appear in more than one round. The companion topics shift by round, so the drill changes with the stage you are facing next.
| Round | Most frequent companion tags on its sorting questions | What to drill |
|---|---|---|
| Phone screen | Hashing 12, intervals 9, arrays 7 | Count-then-rank and sort-by-start problems, at speed |
| Onsite | Hashing 8, greedy 7, arrays 5 | Greedy choices made after a sort, plus the follow-up discussion |
| Online assessment | Greedy 5, intervals 4, arrays 3 | Sort-then-greedy problems under a timer, with edge cases you test yourself |
Our take: the phone-screen mix rewards fluency more than depth. Hash maps and interval sweeps are patterns you can drill to the point where the first correct version takes a fraction of the slot. Aim to reach a correct, tested solution early enough to take the follow-up, because the follow-up is where an experienced candidate shows level.
How do Amazon and Google questions differ?
They lean on different companion topics. Of Amazon's 21 sorting questions, 7 also carry the hashing tag, with greedy, arrays and intervals on 4 each. Google's 17 lean toward intervals, with 6, while hashing appears on just 1. For Amazon, pair sorting with frequency counting; for Google, pair it with timeline and interval sweeps.
| Company | Sorting questions filed | Companion tags among them |
|---|---|---|
| Uber | 13 | Intervals 3, arrays 3, greedy 2, hashing 1 |
| Meta | 11 | Arrays 2, hashing 1, greedy 1, intervals 1 |
| Microsoft | 11 | Hashing 3, greedy 3, intervals 2, arrays 1 |
| ByteDance | 10 | Intervals 3, hashing 1, greedy 1, arrays 1 |
The meeting-rooms family crosses company lines. Meeting Rooms is filed under Uber, Amazon, Meta and Netflix, and Maximum Concurrent Processes / Meeting Rooms under Amazon, ByteDance and Google. If you can prepare only one interval problem for any of these loops, make it this family, and practise Maximum Concurrent Processes / Meeting Rooms as the counting variant.
A worked example: an Amazon phone screen next week
Say your next round is an Amazon phone screen. Hashing is the most frequent companion tag on Amazon's sorting questions after sorting itself. A heavily linked Amazon example is Find the Top 10 Most Frequent IP Addresses, with 5 write-ups, all from Amazon, reported in a phone screen in 2026-09. One of its write-up links comes from a candidate who reported a staff-plus or manager level. Its title never mentions sorting, yet the bank tags it sorting. The matching practice pass is to count occurrences in a hash map, then rank by count with a two-level key so ties break predictably, as shown in the next section.
Then compare a Meta phone screen, where the reported example is Kth Largest Element / Quick Select, last reported in 2026-07. There the selection algorithm is the subject. Be ready to partition by hand and to explain why quickselect averages linear time while a full sort costs O(n log n).
Do interviewers want you to write a sort or call one?
Call one, and know what it guarantees. Tech Interview Handbook's guide says basic sorts that run in quadratic time should not be used in interviews, and that you should sort with your language's default sorting function instead. The same guide advises knowing that default's time and space complexity, and adds, "Bonus points if you can name the sort."
Tech Interview Handbook's guide says Java uses Timsort for objects and Dual-Pivot Quicksort for primitives. The split matters in a follow-up: stability only means something for objects, and the object sort is the stable one. For Python, the same guide says Powersort replaced Timsort as the default in 3.11+, while Python's own sorting HOWTO still calls the algorithm Timsort. Do not argue the name in a round; the stability guarantee is the part that matters.
Python's sorting HOWTO says a key function is called exactly once for each input record, which is why key-based sorting is fast. On ties, the Python documentation says: "That means that when multiple records have the same key, their original order is preserved." It adds, "This wonderful property lets you build complex sorts in a series of sorting steps."
Java's Comparator documentation says compare returns a negative integer, zero or a positive integer, and that implementors must ensure the relation is transitive. The same documentation describes Comparator.comparing as taking a function that extracts a sort key, and thenComparing as returning a lexicographic-order comparator combined with another one. Those two methods are the safe way to write a multi-field order. Both snippets below rank (IP, count) pairs by count, highest first, then by IP ascending, with no arithmetic in the comparator:
ranked = sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))entries.sort(Map.Entry.<String, Integer>comparingByValue(Comparator.reverseOrder()).thenComparing(Map.Entry.comparingByKey()));Our take: interviewers get more signal from how you use the default sort than from whether you can recite quicksort. Say which key you sort by, what breaks ties, and whether the sort is stable before you are asked.
Which comparator and stability mistakes cost the follow-up?
The costly ones pass small tests. PracHub's guide shows that a subtraction-based Java comparator overflows with Integer.MIN_VALUE and 1, placing the smallest integer after 1, and recommends Integer.compare, Long.compare or comparator factories instead. In PracHub's words, "The exception is optional: a broken comparator need not throw on your small test."
- Ordered but unstable. PracHub's guide notes that a sort can be ordered and still violate its stability requirement. The same guide warns against sorting ascending and reversing the whole result to simulate a stable descending sort; negate the key or reverse only that field's comparator instead.
- Ties in a hand-written merge. PracHub's guide says taking from the right half on a tie can reverse the original cross-half order.
- Lost or doubled records. PracHub's guide says every input record must appear exactly once, and Tech Interview Handbook's guide lists a sequence with duplicate elements as a corner case.
- Python's in-place sort. Python's documentation says list.sort() modifies the list in place and returns None, so assigning its result to a variable leaves you holding None.
- Sorted sets with partial comparators. Java's documentation warns that a sorted set or map whose comparator is inconsistent with equals will behave strangely. In practice, a TreeSet ordered only by count treats two IP addresses with equal counts as one element and drops the second.
- Vague complexity. PracHub's guide advises saying whether you count comparisons, assignments, swaps, allocations or elapsed time.
Our take: write the comparator checks at the top of your scratch file before every attempt. The failures above are bookkeeping, and bookkeeping improves with a checklist rather than with more theory.
What changes at senior and staff level?
Sorting is not a junior topic in the bank. Write-ups link these questions 75 times from candidates who reported a senior, staff-plus or manager level and 69 times from candidates who reported a junior, new-grad or intern level. Levels are what candidates stated on their own write-ups. Of the four questions linked only from senior-or-above write-ups, two have titles pointing at data split across machines: Distributed Mode and Median and Shard Rebalancing.
| Question | Senior-or-above links | Junior-or-below links |
|---|---|---|
| Distributed Mode and Median | 8 | None |
| Dependency Version Check | 5 | None |
| Minimum Sum-of-Distances Meeting Point on a Line | 4, one of them staff-plus or manager | None |
| Shard Rebalancing | 3 | None |
| File Deduplication | 8 | 5 |
| DAG Allow / Disallow Propagation | 4 | 3 |
| Meeting Rooms | 4 | 5 |
| Kth Largest Element / Quick Select | 2 of its 7 links | Not broken out |
By companion topic, senior-or-above links outnumber junior-or-below links on hashing-tagged questions, 25 to 15, while greedy leans junior, 10 to 13. Our take: those counts reflect which write-ups were collected, not what interviewers weight, but if you are senior we would weight frequency-counting problems a little higher than greedy puzzles.
Our take, inferred from the titles rather than from reported follow-ups: at senior level the sort is the easy first step, and the round is decided by scale, ties and data that does not fit on one machine. After the single-machine version of Distributed Mode and Median or Shard Rebalancing, be ready to explain how the ordering step works when the data is split, using the merge and count techniques above. State how much memory each machine has before you choose between a merge and a count-based approach.
Down-leveling note (our view): a sorting question rarely sets your level on its own; system design depth and the project deep dive carry more of that signal. Inside a coding round, the level signal is in the follow-up: choosing between a sort, a capped heap and quickselect with reasons, stating stability unprompted, and describing the memory-bounded version. A clean solution with no trade-off discussion reads as mid-level.
Do ML and AI candidates see different questions?
Slightly, but the sample is too small to plan around. Software Engineers account for 121 of the links, against 10 from Machine Learning Engineers, 2 from AI Engineers and 1 each from a Research Scientist and a Data Engineer. Dependency Version Check is the exception, with 4 of its 5 links from machine-learning, AI, research or data-science candidates.
Links from those candidates co-tag graphs on 29% and intervals on 21%, against 13% and 10% for software engineers, while hashing drops to 7% from 30%; the split rests on 14 and 129 links. Treat it as a weak signal. If you are an ML engineer, add Dependency Version Check to your list, and otherwise ignore the role split.
Which algorithms and complexities should you still memorise?
Enough to justify your choice of built-in sort or selection. Tech Interview Handbook's guide says "it is good to know the various time complexities of the different sorting algorithms." For interviews that means merge sort, quicksort, heap sort and counting sort at the level of complexity and stability, not an implementation of each.
GeeksforGeeks' comparison table lists merge sort as stable with O(n) space and quick sort as not stable with O(log n) space. Princeton's Algorithms textbook says mergesort is guaranteed to run in linearithmic time. Tech Interview Handbook's guide recommends counting sort for numbers whose range you know beforehand, citing H-Index, and GeeksforGeeks says bucket sort performs well when input is uniformly distributed.
Our take: skip bubble sort and selection sort beyond a sentence each. No reported title in the table asks for them, and time spent there comes out of the product-shaped questions that candidates do report.
How we counted
Counts come from TrueInterview's question bank as of 2026-10-26 and cover the sorting-tagged coding questions filed under big-tech companies. A question can be filed under several companies and reported in several rounds, so tallies overlap. Write-up links count candidate write-ups that point to a question, split by the level each candidate reported; the technique groups are our reading of question titles, and the questions are candidate-reported and reconstructed for practice, not an official list.
FAQ
Will you have to implement merge sort or quicksort?
Rarely as the whole question, judging by the reported titles. Among the most-linked sorting questions, only Kth Largest Element / Quick Select names an algorithm, and it is filed under Meta, ByteDance and LinkedIn. For everything else, use the built-in sort and spend your time on the key, the tie-break and the complexity. If an interviewer does ask for an implementation, merge sort is the safer one to write under pressure, because its stability comes from a single rule: on a tie, take from the left half.
What are the common sorting algorithms to know?
Princeton's Algorithms textbook covers selection sort, insertion sort and shellsort as its elementary sorts, and describes quicksort as "used more widely than any other sorting algorithm". GeeksforGeeks describes counting sort as a non-comparison sort that counts how often each distinct value appears. Add merge sort and heap sort to that list, and learn which of them are stable and what each costs in memory rather than how to code every one from scratch.
Which companies report the most sorting questions?
Amazon and Google lead the bank, followed by Uber, Meta, Microsoft and ByteDance, then Apple with 8, Snowflake with 7, and OpenAI and Stripe with 4 each. These counts reflect what candidates reported, not how often each company asks. For a company lower on that list, the write-up links on individual questions, such as DAG Allow / Disallow Propagation at Snowflake, are a better guide than the company total.
Are these questions current?
Mostly. 88 of the 102 questions were last reported within the 12 months before 2026-10-26. Write-up links by interview quarter run 18 in 2025-Q4, 38 in 2026-Q1, 29 in 2026-Q2 and 49 in 2026-Q3, but those totals mostly reflect how many write-ups were collected, so do not read a trend into them. Use the last-reported month on each question instead.
How do searching and sorting questions connect?
Sorting is often the setup step for a binary search. Tech Interview Handbook's guide says that when a sequence is sorted, binary search should be one of the first ideas to consider. The same guide lists Search in Rotated Sorted Array and Kth Largest Element in an Array among its practice questions. The second is the closest classic to the reported Kth Largest Element / Quick Select, so solve it first if your loop is at Meta or ByteDance.
Your practice plan
A three-week plan for someone working full time, at about an hour a day:
- First week. From the table above, or the questions in the practice bank listed for your target company, pick the ones whose titles never mention sorting. Work those before any textbook sort.
- First week. Solve Merge Intervals and Top K Frequent Elements once each as base patterns, then move on.
- Second week. Solve Meeting Rooms and Kth Largest Element / Quick Select under a phone-screen time limit. TrueInterview says its coding questions are judged on hidden tests that show the case you failed; use that failing case to find the tie or boundary you missed.
- Second week. Solve the Amazon IP-frequency question with a hash map and a two-level key, then rewrite the ranking step with a capped heap and compare the costs aloud.
- Third week. Write a two-level sort from memory in your interview language, state whether its default sort is stable, and replace any subtraction comparator with Integer.compare or a comparator factory.
- Third week, if you are senior or above. Solve Distributed Mode and Median and Dependency Version Check, then explain aloud how the ordering step would change if the input did not fit on one machine.
- Third week, if your loop is at Google. Solve Employee Shift Timeline Table and Maximum Concurrent Processes / Meeting Rooms as timeline sweeps.
Sources
- TrueInterview question bank — sorting at big-tech companies — counted 2026-10-26
- Sorting and searching cheatsheet for coding interviews | Tech Interview Handbook — checked 2026-10-26
- Sorting Techniques — Python 3.15.2 documentation — checked 2026-10-26
- Comparator (Java SE 21 & JDK 21) — checked 2026-10-26
- Sorting Algorithms Interview Questions: Stability, Comparator Contracts, and Counterexamples | PracHub Knowledge Hub — checked 2026-10-26
- Sorting Interview Questions - GeeksforGeeks — checked 2026-10-26
- Sorting — checked 2026-10-26
- Interview prep compared: your application, end to end · TrueInterview — checked 2026-10-26
Last reviewed: 2026-10-26.