Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a program to implement a simple LRU (Least Recently Used) Cache mechanism.

Medium

Problem Statement

Create a program to implement a simple LRU (Least Recently Used) Cache mechanism.

Sample Input

Cache Size: 3, Operations: [1, 2, 3, 4, 2, 5]

Sample Output

Final Cache: 4, 2, 5

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
using System; using System.Collections.Generic; class LRUCache { static void Main() { // Implement the LRU Cache mechanism } }
Log in or sign up to run or submit your code.Log inSign up
Input
Cache Size: 3, Operations: [1, 2, 3, 4, 2, 5]
Expected Output
Final Cache: 4, 2, 5