Reported September 2026
Citadelheap priority queue

Merge Price-Delta Feeds

Reported by candidates from Citadel's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Citadel OA. Under 2s to a working solution.
Founder's read

Citadel reported this one in September 2026, and it looks scarier than it is. Strip the finance wrapper and it's a k-way merge of sorted lists, followed by a running sum. That's it. If you've got an OA invite and 48 hours, this is the kind of problem you can pattern-match in one read. The only real work is the tie-breaking rule and keeping the heap small. If your mind goes blank mid-assessment, StealthCoder runs invisibly on your desktop and can hand you the merge structure so you're not rebuilding it from scratch under pressure.

The problem

You are given feeds, where each feed is a list of events sorted by nondecreasing timestamp. An event is [timestamp, delta].
Merge all events in chronological order. For equal timestamps, process the lower feed index first; events tied within one feed retain their original order. Start the absolute price at 0. After processing each event, add its delta to the price and append the new price to the result. Deltas and the running price may be negative. Empty feeds are allowed.

Function
mergePriceFeeds(feeds: int[][][]) → int[]

Examples
Example 1
feeds = [[[1,5],[4,-2]],[[1,3],[3,7]],[]]
return = [5,8,15,13]
The equal timestamp-1 events use feed order, followed by timestamps 3 and 4.
Example 2
feeds = [[],[[2,-4],[2,1]]]
return = [-4,-3]
Within one feed, equal-time events preserve source order.

Constraints
0 <= feeds.length <= 10000.
The total number of events is at most 200000.
Each event has exactly two integers.
Each feed is sorted by timestamp.
All intermediate prices fit in a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

What it really reduces to: merge k sorted arrays, then prefix-sum the deltas. Use a min-heap holding one event per feed, keyed by (timestamp, feedIndex). Push the first event of each non-empty feed, pop the smallest, add its delta to the running price, append that price, then push the next event from the same feed. The tie rules fall out for free. Equal timestamps across feeds break on feed index, and equal timestamps within a feed stay in order because you only ever push the next event after popping the previous one. Pitfall: don't concatenate everything and sort without a stable key, and don't forget empty feeds or a zero-length input. Total work is O(N log k) for N events and k feeds. If the heap logic slips under the clock, StealthCoder is your hedge for the live OA.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Merge Price-Delta Feeds cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Citadel's OA.

Citadel reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Merge Price-Delta Feeds FAQ

What's the trick in Merge Price-Delta Feeds?+

It's a k-way merge. Keep a min-heap of (timestamp, feedIndex, eventIndex), pop the smallest, update the running price, then push the next event from that feed. The running sum is just a single variable you add to as you pop.

How do I handle the tie-breaking rules?+

Key the heap on timestamp, then feed index. Within a feed, order is preserved because you only push the next event after popping the current one. You can also skip the heap and do a stable sort on (timestamp, feedIndex) over all events, which works at 200000 events.

Can I just flatten and sort everything?+

Yes, if the sort is stable and keyed on (timestamp, feedIndex), with original order kept inside a feed. It's O(N log N) instead of O(N log k). Both fit the constraints, but the heap is the cleaner answer if the interviewer asks about scaling.

What edge cases break solutions?+

Empty feeds, an empty feeds list, and negative deltas. Don't assume the price stays positive. Don't push empty feeds onto the heap. Also make sure you record the price after every event, not only at the end of each timestamp group.

How do I prepare for this in 48 hours?+

Write a k-way merge with a heap once from memory, then add the running sum and the feed-index tiebreak. Test on both examples. If you can do Merge k Sorted Lists cold, this is a small step beyond it.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Citadel.

OA at Citadel?
Invisible during screen share
Get it