Reddit Coding Interview Questions
100 Reddit coding interview problems with full optimal solutions — 34 easy, 52 medium, 14 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Reddit interviewer values, and a FAQ section.
Showing 36 problems of 100
- #1easyfrequently asked
1. Two Sum
Given an array of integers and a target, return indices of the two numbers that add up to target. Reddit uses this as a warm-up to test if you reach for a hash map without prompting — the same reflex that powers vote-deduplication and karma-event lookups.
- #2easyfrequently asked
2. Valid Parentheses
Determine if a string of brackets is balanced. Reddit uses this to test stack intuition — the same data structure that backs their comment-tree depth tracking and markdown parser for self-post bodies.
- #3easyfrequently asked
3. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list. Reddit uses this to test pointer hygiene — the same skill needed to merge ranked feed streams (hot + new + rising) without losing or duplicating posts.
- #6easyfrequently asked
6. Search Insert Position
Find the index where a target should be inserted in a sorted array. Reddit uses this binary-search variant to gate whether candidates can implement lower_bound correctly — critical for ranked feed insertion when a new post enters Hot.
- #7easyfrequently asked
7. Maximum Subarray
Find the contiguous subarray with the largest sum. Reddit uses this to filter for candidates who recognize Kadane's algorithm — the same running-sum idea that powers their hot-score windowed-vote calculation.
- #9easyfrequently asked
9. Merge Sorted Array
Merge two sorted arrays into the first one in-place. Reddit uses this to test back-pointer technique — the same insight powering their in-place merging of ranked feed segments without allocating a new array per request.
- #10easyfrequently asked
10. Binary Tree Inorder Traversal
Return the inorder traversal of a binary tree. Reddit asks this to test recursive vs. iterative fluency — the same primitive used to flatten their nested comment trees into linear render lists.
- #13easyfrequently asked
13. Maximum Depth of Binary Tree
Compute the depth of a binary tree. Reddit asks this to gauge basic recursion — the same primitive used to measure how deeply a comment tree can nest before they collapse it with 'continue this thread →' links.
- #17easyfrequently asked
17. Best Time to Buy and Sell Stock
Find the max profit from one buy + one sell of a stock-price array. Reddit uses this as a streaming-window template — the same single-pass shape used to find the best upvote burst within a post's lifetime.
- #20easyfrequently asked
20. Linked List Cycle
Detect whether a linked list has a cycle. Reddit uses Floyd's cycle detection (tortoise and hare) to test pointer fluency — the same algorithm used in their comment-graph integrity checker to detect malformed reply cycles.
- #21easyfrequently asked
21. Min Stack
Design a stack that supports push, pop, top, and getMin in O(1). Reddit uses this to test data-structure design — the same auxiliary-state pattern they use to maintain hottest-comment-so-far while streaming an active comment thread.
- #23easyfrequently asked
23. Majority Element
Find the element that appears more than n/2 times in an array. Reddit uses Boyer-Moore voting to test whether candidates recognize specialized algorithms — the same vote-majority pattern matters for their vote-fraud detection (one IP shouldn't dominate a thread).
- #30easyfrequently asked
30. Reverse Linked List
Reverse a singly linked list. Reddit asks this to gauge pointer fluency — the most-asked easy LL problem. The skill maps directly to reversing chronological vote-event chains during fraud investigation.
- #31mediumfrequently asked
31. Add Two Numbers
Add two big integers represented as linked lists (least-significant-digit first). Reddit asks this to test linked-list arithmetic with carry — the same kind of pointer-walking they use to merge cross-shard counter chunks.
- #32mediumfrequently asked
32. Longest Substring Without Repeating Characters
Find the longest substring without repeating characters. Reddit asks this to test sliding-window technique — the same pattern used to find the longest run of non-duplicate IPs hitting an endpoint (a fraud-detection primitive).
- #34mediumfrequently asked
34. Container With Most Water
Given heights, find the two lines that form the container holding the most water. Reddit uses this two-pointer problem to test greedy/monotone intuition — analogous to choosing the two endpoints of a time-window to maximize comment volume.
- #35mediumfrequently asked
35. 3Sum
Find all unique triplets that sum to zero. Reddit uses this to test sort + two-pointer + dedup — the same triple-key correlation used in their abuse-detection to find triple-coincidence patterns (IP + user-agent + timing).
- #37mediumfrequently asked
37. Remove Nth Node From End of List
Remove the Nth-from-end node in a single pass. Reddit asks this to test the two-pointer-with-gap technique — the same windowed-walk used in their rate-limiter to expire the Nth-most-recent event.
- #41mediumfrequently asked
41. Search in Rotated Sorted Array
Search for a target in a rotated sorted array in O(log n). Reddit asks this to test binary-search variants — the same skill used when their pagination cursor wraps around a sorted vote-timestamp index.
- #49mediumfrequently asked
49. Group Anagrams
Group strings that are anagrams of each other. Reddit uses this to test hash-key design — the same shape used when clustering near-duplicate post titles for spam detection (sort the letters to get a normalized fingerprint).
- #52mediumfrequently asked
52. Merge Intervals
Merge overlapping intervals. Reddit uses this canonical interval problem to test sort + scan — the same shape used when merging consecutive vote-window aggregations into a single hot-score period.
- #60mediumfrequently asked
60. Subsets
Generate all 2^n subsets of a set of distinct integers. Reddit uses this to test backtracking and bitmask enumeration — the same enumeration used when computing all flag-combination buckets for feature-rollout cohorts.
- #64mediumfrequently asked
64. Binary Tree Level Order Traversal
Return level-order traversal of a binary tree as a list of lists. Reddit uses this BFS warm-up to test queue technique — the same shape used in their comment-tree renderer which paginates by depth level.
- #67mediumfrequently asked
67. Validate Binary Search Tree
Determine whether a binary tree is a valid BST. Reddit uses this to test the bounded-recursion pattern — the same shape used when validating that a comment-tree's parent timestamps satisfy a strict-monotonic constraint.
- #68mediumfrequently asked
68. Word Break
Determine if a string can be segmented into words from a dictionary. Reddit uses this DP problem to test the prefix-suffix decomposition pattern — the same shape used when tokenizing usernames into recognized subreddit references during mention detection.
- #69mediumfrequently asked
69. LRU Cache
Design an LRU cache with O(1) get and put. Reddit uses this to test data-structure composition (hash + doubly-linked-list) — the same primitive used in their hot-post cache eviction layer in front of Postgres.
- #70mediumfrequently asked
70. Number of Islands
Count the number of connected components of 1s in a grid. Reddit uses this DFS/BFS classic to test grid traversal — the same shape used when clustering coordinated abuse cells in their fraud-detection IP-grid.
- #71mediumfrequently asked
71. Course Schedule
Determine if you can finish all courses given prerequisite pairs (cycle detection in a DAG). Reddit uses this to test topological-sort intuition — the same shape used when validating cross-shard data-migration dependency graphs.
- #73mediumfrequently asked
73. Implement Trie (Prefix Tree)
Implement a trie supporting insert, search, and startsWith. Reddit uses this to test prefix-tree design — the same data structure they use in their autocomplete service for subreddit and username completion.
- #74mediumfrequently asked
74. Kth Largest Element in an Array
Find the kth-largest element. Reddit uses this to test heap and quickselect — the same primitive that powers their top-k post selector for ranking feed pages.
- #79mediumfrequently asked
79. Lowest Common Ancestor of a Binary Tree
Find the lowest common ancestor of two nodes in a binary tree. Reddit uses this canonical LCA problem to test post-order recursion — the same shape they use to find the nearest common parent comment when merging conflicting moderator threads.
- #80mediumfrequently asked
80. Product of Array Except Self
Return an array where each element is the product of all others (no division). Reddit uses this to test prefix/suffix product technique — the same shape used in their cross-shard counter reconciliation where you compute totals excluding one shard.
- #81mediumfrequently asked
81. Top K Frequent Elements
Return the k most frequent elements in an array. Reddit uses this to test count + heap design — the exact shape of their trending-words detector in subreddit titles over a time window.
- #89hardfrequently asked
89. Merge k Sorted Lists
Merge k sorted linked lists into one sorted list. Reddit uses this to test heap-based merging — the exact shape used when merging hot/new/rising/controversial ranked streams into a single user feed.
- #95hardfrequently asked
95. Trapping Rain Water
Compute how much rain water is trapped between elevation bars. Reddit uses this to test two-pointer + min/max tracking — the same shape used to identify dips between vote-volume peaks in their popularity-decay analysis.
- #100hardfrequently asked
100. Minimum Window Substring
Find the smallest substring of s containing all chars of t. Reddit uses this sliding-window hard problem to test the contract-and-expand pattern — the same shape used when searching for the smallest active vote-window covering a target user-set during fraud audits.