Microsoft - New Grad SWE

Title:
Microsoft - Software Engineer (New Grad) - Onsite Interview

Description:
Level: Entry-Level / New Grad
Education: Bachelors in Computer Science
Years of Experience (YOE): 0
Questions Asked:

1. Reverse Linked List
Example 1:
Input: 1 → 2 → 3 → 4 → 5 → null
Output: 5 → 4 → 3 → 2 → 1 → null

Example 2:
Input: null
Output: null


2. Implement LRU Cache
Example:
LRUCache cache = new LRUCache(2) // capacity is 2
cache.put(1, 1)
cache.put(2, 2)
cache.get(1) → returns 1
cache.put(3, 3) → evicts key 2
cache.get(2) → returns -1 (not found)
cache.put(4, 4) → evicts key 1
cache.get(1) → returns -1 (not found)
cache.get(3) → returns 3
cache.get(4) → returns 4