Two Sigma Question 1 — Merge Sensor Data
The Merger class has two public methods:
acceptBatches(batches: List<List<…>>) :
Pass N batches of delta-encoded elements where the ith batch corresponds to data from the ith sensor.
Data within a batch is sorted by timestamp and delta-encoded.
Do not rely on references to the batches after acceptBatches returns.
getNextElement() → ? :
Return the next (timestamp, data) pair from the merged output sequence.
The data should be delta-encoded and sorted by timestamp.
You can assume that acceptBatches will only be called once immediately after the Merger is constructed.
Example usage:
merger := Merger(3)merger.acceptBatches([# sensor 0: [(0, 100), (2, 2), (5, 3)], # sensor 1: [(1, 110), (3, 5)], # sensor 2: [(4, 115), (7, -10)]]) assertEquals(merger.getNextElement(), (0, 100))assertEquals(merger.getNextElement(), (1, 10))# consume the remaining elements
Constraints:
- The elements within each batch are sorted by time
- Data and timestamp are 32-bit integers
- Batches are not mutable
Optional Extension:
We want to extend the Merger implementation to be able to call acceptBatches multiple times as the sensors continue producing data.
The data from a sensor is delta-encoded across batches as well.

Two Sigma Question 2 — Linux Performance Drop
An application running on Linux used to process 1000 requests per second.
Now it is only processing 2 requests per second.
How will you troubleshoot this issue?
wo Sigma Question 3 — Meeting Overlap
Given an array of meeting time intervals consisting of start and end times
[[s1, e1], [s2, e2], …], determine if a person could attend all meetings without overlap.
Input:
An array of meeting intervals where each interval is represented as [start, end].
Example 1:
meetings := [][]int{{0, 30}, {5, 10}, {15, 20},}
Output:
false (because the person has overlapping meetings)
Two Sigma Question 4 — Unique Triplets Sum to Target (3Sum Variant)
Given an array of integers nums and an integer target,
return an array of arrays containing all unique triplets that add up to target.
Each triplet in the returned array should be in ascending order.
You can assume nums has a size of at least 3.
Example:
Input: nums = [-1, 0, 1, 2, -1, -4], target = 0
Output: [[-1, -1, 2], [-1, 0, 1]]
Two Sigma Question 5 — Minimum Operations (Divide by 2 / +1)
n — integer
Operations allowed:
- divide by two if divisible
- increment by 1
Find the smallest number of operations needed to reduce n to 1.
n = 1 (example baseline)
Two Sigma Question 6 — Maximum Path Sum Between Alive Leaf Nodes
Given a binary tree, find the maximum path sum from any two alive nodes within the tree.
A node is an alive node if and only if it is a leaf node, indicated by an asterisk below.

Two Sigma Question 7 — Maximum Path Sum Between Alive Nodes (General Alive Nodes)
What if the tree we are given can have alive nodes at non-leaf nodes as well?
Find the maximum path between any two alive nodes within the tree.
A maximum path may only have the two alive nodes without any other alive nodes in between.
For example, the alive nodes are highlighted with asterisks:
5 / \ 2* 0 / \ / \ 100* 50* 4* 15*
#100 + 2 + 50 = 152
Two Sigma Question 8 — Merge Sensor Data (Streaming + Multiple Batches)
To save space, the data emitted by each sensor is delta-encoded, meaning the sensor emits the differences between values rather than the values themselves.
For example, instead of:
[100, 102, 105, 100]
the sensor emits:
[100, 2, 3, -5]

The sequence of elements outputted by the merger should also be delta-encoded.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including Two Sigma, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for these companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.