Reported September 2026
Millennium

Debug the Tape Cleaner

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

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

Millennium reported this one in September 2026, and it's not a normal query question. You get a broken clean_tape function and have to find where it breaks the spec. The data structure that matters is a time-ordered table, and the whole job is getting the order of operations right: sort, dedupe, null out bad prices, then forward-fill each asset on its own. If you've got the OA in a day or two, this page is the script. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment.

The problem

The desk runs clean_tape over the raw market-data tape before any strategy reads it. It has been in production for months. Recently the traders have started reporting occasional bad prints slipping through, stale fills appearing at the wrong time, the odd zero or negative price reaching the book, and a few rows that simply look wrong. Most of the time the output looks fine, which is why nobody caught it sooner. Your job is to find out what the cleaner is getting wrong and fix it.
The Job
clean_tape(prices) already ships (it is in the editor). It is supposed to satisfy the spec below exactly. It does not. Diagnose where it diverges and repair it so that it meets the contract for every input, not just the easy ones.
The Contract
Given a raw price tape, clean_tape must return a cleaned table that obeys all of these rules, in this order:
Sort the rows ascending by timestamp.
Drop duplicate timestamps, keeping the first occurrence after sorting.
Treat any price that is zero or negative as missing.
Forward-fill each asset column from its last valid (post-sort) price.
A leading missing value with no prior valid price stays null (it cannot be filled).
Forward-fill means: if a price is missing, carry forward the most recent valid price for that asset. Each asset column is filled independently.

Tables
prices: source_row PK (Integer), timestamp (Integer), asset_1 (Decimal), asset_2 (Decimal), asset_3 (Decimal)

Constraints
Input Format: prices is a pd.DataFrame with these columns.
timestamp, int, Milliseconds since session open.
FastPrep execution-adapter details (not visible in the source image): The input contains between 1 and 2000 rows.
source_row values are unique positive integers and preserve source arrival order when timestamps tie.
Each asset value is an exact decimal or NULL.
The returned columns are row_index, timestamp, asset_1, asset_2, and asset_3.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that the contract is an ordered pipeline, and the bugs hide in the order. Sort by timestamp first, with source_row as the tiebreaker so ties keep arrival order. Then dedupe on timestamp, keeping the first row. Only after that do you treat zero or negative prices as null, because a bad print on a duplicate row you're about to drop shouldn't matter. Forward-fill last, per column, so asset_1 never borrows from asset_2. The classic pitfall is filling before dropping duplicates, or treating only zero as bad and missing the negatives. Another is filling a leading null with something. It has to stay null. In SQL terms, think ROW_NUMBER for dedupe, a CASE to null bad prices, and a last-non-null window per asset. If the window logic fogs out on the live assessment, StealthCoder can hand you the working query.

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 Debug the Tape Cleaner 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 Millennium's OA.

Millennium 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.

Debug the Tape Cleaner FAQ

What's the trick in the Millennium Debug the Tape Cleaner question?+

Order of operations. Sort by timestamp with source_row as tiebreaker, dedupe keeping the first, null out prices of zero or less, then forward-fill each asset column independently. Most hidden bugs come from doing these steps in the wrong order or skipping the negative case.

How do I forward-fill in SQL?+

Use a window function. Take the last non-null value over rows ordered by timestamp, from unbounded preceding to the current row, partitioned by nothing and applied separately to each asset column. If your dialect lacks IGNORE NULLS, use a running count of valid values as a group key, then take the max within each group.

Should bad prices be nulled before or after deduping?+

After. The contract says sort, then drop duplicate timestamps, then treat zero or negative as missing. Dedupe keeps the first row after sorting, even if its price is bad. That bad price then becomes null and gets filled from earlier valid data.

What edge cases will the hidden tests hit?+

Leading nulls that must stay null, negative prices, zero prices, tied timestamps where source_row decides which row survives, and a single-row input. Also check that each asset fills only from its own column, never from a neighbor.

How do I prepare for this in 48 hours?+

Practice window functions: ROW_NUMBER for dedupe, CASE for nulling, and last-non-null fills. Write the full pipeline once on a small messy table and check each stage's output. Then reread the contract and confirm your steps follow its exact order.

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

OA at Millennium?
Invisible during screen share
Get it