Design a Weighted Cache (Phone Screen)
Implement a weighted cache WeightedCache<K,V>.
APIs
get(K key) -> V | nullput(K key, V value, int weight) -> void
Constraints
- The cache has a maximum capacity
maxWeightme...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
