← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Implement a credit system that tracks GPU credits over time. Three operations must be supported, all tagged with a monotonically increasing timestamp:
The system must process a stream of these calls in the order they are given and, for every cost operation, immediately return whether it succeeded. Internally you must deduct the oldest still-valid credits first (FIFO order among non-expired batches). You may assume that all operation timestamps are strictly increasing and that every t_expire is greater than the add time. Implement the class GpuCreditManager with methods add, cost, and any helper state you need.