New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Coding Question
AI Insights
Quick Summary
Process a sequential list of buy and sell trades to update a starting cash balance and stock holdings.
Track individual stock quantities efficiently while adjusting the cash balance for each transaction.
Format the final state as a list of symbol-quantity pairs, including remaining cash, sorted alphabetically.
What This Tests
Dictionary-based state tracking for dynamic collections
Sequential iteration and arithmetic updates
Data type conversion and string formatting
Alphabetical sorting of collection keys
Common Patterns
Hashing
Sorting
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected