Stock Marking Position Monitor
Updated
Problem statement
You get a stream of trading events. Keep separate state for each stock symbol.
Each event is a comma-separated string in one of these forms:
SHARES,symbol,delta: add the signed integerdeltato the number of shares held forsymbol.SELL,symbol,delta: add the signed integerdeltato the total quantity of open sell orders forsymbol.
Every symbol starts with zero shares held and zero open sell quantity. After each event, work out the marking position of that event's symbol:
marking position = held shares - open sell quantity
Return one string per event, in the same order as the events. Write each one as symbol:markingPosition.
Function
markPositions(events: String[]) → String[]Examples
Example 1
events = ["SHARES,AAPL,100","SELL,AAPL,30","SHARES,MSFT,50","SELL,AAPL,-10"]return = ["AAPL:100","AAPL:70","MSFT:50","AAPL:80"]The two symbols have separate state. The final event reduces the open AAPL sell quantity from 30 to 20, so its marking position becomes 100 - 20 = 80.
Example 2
events = ["SHARES,NVDA,12","SELL,NVDA,12","SELL,NVDA,-5","SHARES,NVDA,-2"]return = ["NVDA:12","NVDA:0","NVDA:5","NVDA:3"]A negative delta lowers a total, so later events can undo part of earlier ones. After all four events, NVDA has 10 held shares and 7 open sell quantity. So its last marking position is three.
Constraints
1 <= events.length <= 10^5.- Every event has exactly three comma-separated fields and begins with
SHARESorSELL. - Each symbol contains only uppercase English letters and has length from
1through10. - Each delta is a signed 32-bit integer.
- After every event, held shares and open sell quantity for the affected symbol are both between
0and10^12, inclusive.
More Akuna Capital Online Assessment questions
- Last Digit of the Ways to Split Traders Between Two OfficesOA · Seen Dec 2026
- Light Bulbs Left On After All Engineers FinishOA · Seen Dec 2026
- Delivery Management SystemOA · Seen Nov 2026
- Count Server ReplacementsOA · Seen Nov 2026
- Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Maximum Remaining Drone PowerOA · Seen Nov 2026
- Rolling MetricsOA · Seen Oct 2026
- Vowel Substring GameOA · Seen Sep 2026
- Competitive ForagingOA · Seen Sep 2026
- Binary CircuitOA · Seen Sep 2026
Similar questions at other companies
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
- Corporate Card Expense RulesRippling · OA · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- Least Recently Used CacheMicrosoft · OA · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
- Parcel Event TrackingAirbnb · OAAirbnb interview questions
- Process Banking OperationsVercel · OA
- Expiring Authentication Token ManagerIBM · OAIBM interview questions
- Layer History with Batch Undo and RedoFigma · OA · PHONE SCREENFigma interview questions
- Event Statistics AggregatorWells Fargo · OAWells Fargo interview questions
- Temporal Key-Field Database with Prefix ScansThe Trade Desk · OA
- Per-Client Sliding-Window Rate LimiterGeneral Motors · OA
Akuna Capital interview experiences
- Akuna Capital Quant Trader and QR Interviews: 5 Experiences
- Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
- Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
- Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
- Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
- Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)