LRU Cache Simulator

Programming Interview Hard 9 views
Back to Questions

Problem Description

Implement an LRU cache of capacity C. You will get q operations: GET key and PUT key value. For each GET print value or -1.

Input Format

See description.

Output Format

See description.

Sample Test Case

Input:
2 6 PUT a 10 PUT b 20 GET a PUT c 30 GET b GET c
Output:
10 -1 30

Constraints

Total operations up to 200000.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next