FastPrepClean the Tape
Problems/Clean the Tape

Clean the Tape

Millennium logoMillennium● MediumNEW GRADINTERNOA

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: Reported in a Millennium online assessment for new grad and intern roles. The report gives the cleaning order and the rules for missing values. It does not show complete sample tables or how precise the timestamps are. Here timestamps are whole seconds with no time zone, so every supported language keeps the same rows.

Our version is about 97% the same as the reported question.

The prices table contains a market-data tape for three assets. Return a cleaned tape with the columns row_index, timestamp, Asset_1, Asset_2, and Asset_3.

Cleaning rules

  1. Remove rows that are exact duplicates across timestamp and all three asset columns.
  2. Sort the remaining rows by timestamp in ascending order.
  3. Treat every asset value less than or equal to 0 as missing.
  4. For each asset independently, forward-fill a missing value from that asset's most recent positive value in the sorted tape.
  5. Never backfill. If an asset has no earlier positive value, keep the output value NULL.
  6. Reset the row index after sorting so that row_index is 0, 1, and so on.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

prices

Raw price-tape rows with timezone-neutral whole-second timestamps. Column order is timestamp, Asset_1, Asset_2, Asset_3.

ColumnTypeNullableDescription
timestampTimestampNoTimezone-neutral observation time in whole-second YYYY-MM-DD HH:MM:SS precision.
Asset_1DecimalYesObserved price for Asset_1.
Asset_2DecimalYesObserved price for Asset_2.
Asset_3DecimalYesObserved price for Asset_3.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
row_indexIntegerNoZero-based index after cleaning and sorting.
timestampTimestampNo—
Asset_1DecimalYes—
Asset_2DecimalYes—
Asset_3DecimalYes—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • The input contains at least 1 row and at most 2000 rows.
  • Every timestamp is timezone-neutral and uses whole-second YYYY-MM-DD HH:MM:SS precision.
  • After exact duplicate rows are removed, no two remaining rows share the same timestamp.
  • Each asset value is a decimal or NULL.
  • An exact duplicate may occur more than once and must contribute only one output row.
  • Return rows in ascending timestamp order with the exact result-column order shown.

More Millennium Online Assessment questions

  • Calculate the Half SpreadOA · Seen Sep 2026
  • Debug the Impact ModelOA · Seen Sep 2026
  • Debug the Risk-Limit QuoterOA · Seen Sep 2026
  • Hedge Inventory with Return CovarianceOA · Seen Sep 2026
  • Quote One RequestOA · Seen Sep 2026
  • Risk Limits and Inventory SkewOA · Seen Sep 2026
  • Track the Book and Mark Final PnLOA · Seen Sep 2026
  • Client Markout AnalysisOA · Seen Sep 2026
  • Debug Fair-Value LookupOA · Seen Sep 2026
  • Debug the Tape CleanerOA · Seen Sep 2026

Similar questions at other companies

  • Request Routing SystemStripe · OAStripe interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
  • Build Sessions from Unordered Events (Part 1)Scale AI · OAScale AI interview questions
  • Prepare Taxi Driver Classification DataBoston Consulting Group · OABoston Consulting Group interview questions
  • Macaron Order PriceOpenAI · OAOpenAI interview questions
  • Sorted Cyclic Shift Difference SumsCapital One · OACapital One interview questions
  • Optimize Package Order by Sorting One WindowAmazon · OA
  • Track Received Byte RangesRoblox · OARoblox interview questions
  • Temporal Key-Field Database with Prefix ScansThe Trade Desk · OA

Millennium interview experiences

  • Millennium Full Stack Engineer Java Interview: 1 Experience
All Millennium interview questionsSee Millennium hiring insights