← Back
00:00

Fractional Share Inventory

Robinhood interview questions · Hard · Coding round · reported 12× · 7 tests

Robinhood lets customers trade fractional shares, but the exchange only fills whole shares. Your job is to maintain Robinhood's own fractional inventory for each ticker as customer orders arrive.

Interface

interface Order {
  ticker: string;
  side: 'B' | 'S';      // B = customer buys from Robinhood, S = customer sells to Robinhood
  quantity: string;     // share hundredths like "42" or dollar amount like "$42"
  pricePerShare: string; // cents with two implied decimals, e.g. "250" = 
.50 } interface InventoryRow { ticker: string; quantity: string; // share hundredths remaining at Robinhood after processing } reconcileFractionalInventory( orders: Order[], inventory: InventoryRow[], ): InventoryRow[]

Rules

Idle