Skip to main content

Redis Coding Interview Questions

25 Redis coding interview problems with full optimal solutions — 8 easy, 12 medium, 5 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Redis interviewer values, and a FAQ section.

Showing 12 problems of 25

  • #9mediumfoundational

    9. LRU Cache

    Design a fixed-capacity Least-Recently-Used cache with O(1) get/put; this is the most asked Redis interview question because it mirrors maxmemory-policy allkeys-lru.

  • #10mediumfoundational

    10. Number of Islands

    Count connected '1' regions in a 2D grid; Redis uses it to verify clean BFS/DFS hygiene before discussing cluster-partition reconnection.

  • #12mediumfoundational

    12. Top K Frequent Elements

    Return the k most frequent integers; Redis uses it to probe bucket-sort and heap thinking, the same patterns powering Redis Streams XAUTOCLAIM and ZSET top-K queries.

  • #13mediumfoundational

    13. Design Twitter

    Implement a simplified Twitter with postTweet, getNewsFeed, follow, unfollow; Redis loves it because the optimal solution is the Redis fan-out-on-read pattern.

  • #14mediumfoundational

    14. Insert Delete GetRandom O(1)

    Design a set supporting insert, remove and getRandom all in O(1); Redis loves it because SRANDMEMBER and dict-table sampling use the same trick.

  • #16mediumfoundational

    16. Task Scheduler

    Compute the minimum CPU cycles to execute tasks with a cool-down constraint; Redis uses it to probe scheduling logic that mirrors expiration sampling in cron.c.

  • #17mediumfoundational

    17. Snapshot Array

    Implement an array with O(1) set/snap and O(log) snapshot reads; Redis uses it because the data structure mirrors how RDB snapshots cooperate with copy-on-write forks.

  • #18mediumfoundational

    18. Design Underground System

    Track passenger check-in/check-out and compute average travel times; Redis uses it to test hash and counter aggregation patterns close to Streams + HINCRBYFLOAT.

  • #19mediumfoundational

    19. Time Based Key-Value Store

    Implement a KV store that returns the most recent value with timestamp <= query; Redis loves it because it mirrors ZADD + ZREVRANGEBYSCORE patterns for time-series.

  • #20mediumfoundational

    20. Subarray Sum Equals K

    Count the number of contiguous subarrays that sum to k; Redis uses it to test prefix-sum + hashmap intuition, the same trick that powers GETSET cumulative counters.

  • #21mediumfoundational

    21. Word Break

    Decide whether a string can be segmented into space-separated dictionary words; Redis uses it as a DP/memoization probe that overlaps with how the engine matches CONFIG GET glob patterns.

Redis Coding Interview Questions — Full Solutions — InterviewChamp.AI