← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a credit manager that tracks GPU credits that can be added, expire, and be consumed. The system must support three operations, all tagged with a monotonically increasing timestamp t:
All operations arrive in non-decreasing order of t. The implementation must be optimized for high throughput: add and cost must run in amortized O(log n) or better, and query in O(1). You may assume that the total number of add operations is ≤ 10⁶ and that credit values and balances never exceed 2³¹-1.