Last year, while mentoring a few undergraduate Computer Science students, one of them said something that intrigued me: “I do not think we will have jobs by the time we graduate.”
With models like Claude, Gemini, and GitHub Copilot improving so quickly, solving UPSC and IIT questions with near perfect accuracy, generating apps from a few lines of prompts, and performing tasks that look almost identical to real developer work, I could understand their fear.
But when you speak to actual developers, the concern is rarely whether AI can write code. It’s how that code is written.
So, I decided to test these models myself and share what I found.
To keep this benchmark fair, I used the same process for all three models: GPT 5.2, Gemini 3.0, and Opus 4.5. I selected three tasks that represent different aspects of actual developer work, and each model received the exact same prompt for every task without any modifications during the first attempt.
After collecting the outputs, I ran the code locally wherever necessary to verify correctness and behavior. All models produced working solutions on the first attempt.
The screenshots and code snippets shown in the next sections reflect how each model performed on its first attempt.
For the first task, I chose an LRU Cache implementation because it tests reasoning, data structure design, and edge case handling. These will reveal whether the model truly understands algorithmic constraints or not.
<aside>
An LRU (Least Recently Used) Cache is a small storage system that automatically removes the item you haven’t used for the longest time. It must perform every operation in O(1) time, which means that each action should be instant, no matter how many items are stored. Models can use JavaScript’s Map() or build their own structure using a hashmap + linked list, which is a common pattern for fast lookup and fast reordering.
</aside>
Implement an LRU (Least Recently Used) Cache in JavaScript.
The cache should support:
- constructor LRUCache(capacity)
- get(key) -> return the value or -1 if the key is not present
- put(key, value) -> insert or update the key; if capacity is exceeded, evict the least recently used item
Requirements:
1. Both get() and put() must run in O(1) time.
2. You may use either:
- JavaScript's built-in Map(), or
- a custom doubly linked list + hashmap.
3. Add brief comments explaining your approach.
4. At the bottom of the file, include 3–4 minimal test cases showing:
- basic insertion
- updating an existing key
- eviction order
- capacity = 0 behavior
Return a single runnable JavaScript file that I can execute with Node.js.
Do not wrap the answer in Markdown. Just return the raw .js file content.
class LRUCache {
constructor(capacity) {
this.capacity = capacity;
this.map = new Map();
}
get(key) {
if (!this.map.has(key)) return -1;
const value = this.map.get(key);
this.map.delete(key);
this.map.set(key, value);
return value;
}
put(key, value) {
if (this.capacity === 0) return;
if (this.map.has(key)) {
this.map.delete(key);
}
this.map.set(key, value);
if (this.map.size > this.capacity) {
const lruKey = this.map.keys().next().value;
this.map.delete(lruKey);
}
}
}
