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" = Rules
Run your code with Ctrl+Enter to see results.