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
Perplexity
Coding Question
AI Insights
Quick Summary
Simulate a credit management system where grant and usage events arrive out of chronological order.
Query the total balance at a specific time by replaying all known events in strict timeline order.
Deduct credits from active grants using a greedy strategy that prioritizes soonest-expiring credits.
What This Tests
Event simulation and chronological processing
Priority queue management for interval scheduling
State tracking under asynchronous inputs
Greedy allocation strategies
Common Patterns
Heap / Priority Queue
Sorting
Hashing
Greedy
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