Question 1: LRU Cache
Design an LRU Cache that supports get(key) and put(key, value) operations in O(1) average time complexity. Explain why a hash map and doubly linked list are used.
Question 2: Maximum Subarray Sum
Given an integer array containing positive and negative elements, find the maximum sum of a contiguous subarray. Explain Kadane's algorithm and its time complexity.
Design a URL Shortener like Bitly.
The interviewer asked me to explain how I would design a system that converts long URLs into short links and redirects users to the original URLs.
I discussed API design, database schema, unique short-code generation, collision handling, caching using Redis, and how the system could scale to handle a large number of requests.
Overall Experience
The interview tested both theoretical knowledge and practical problem-solving. The interviewer was interested in understanding my thought process, the reasoning behind my approaches, and my ability to analyze time and space complexity.
My key takeaway was that strong DSA fundamentals, clear understanding of core CS subjects, and the ability to explain design decisions are essential for software development interviews.