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

Programming Exercises

Build a component that simulates a simple LRU (Least Recently Used) Cache and displays the cache contents after each operation.

Hard

Problem Statement

Build a component that simulates a simple LRU (Least Recently Used) Cache and displays the cache contents after each operation.

Sample Input

[1, 2, 3, 4, 2, 5]

Sample Output

Cache Contents: [3, 5, 2]

Limits

Time: 2s · Memory: 256 MB

Code Editor

Try your code in this preview. Submit marks it done.

import React, { useState } from "react";
 
 const LRUCache = () => {
  return (
  <div>
  {/* Display the cache contents */}
  </div>
  );
 };
 
 export default LRUCache;