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 21 problems of 100
- #4easysometimes asked
4. Remove Duplicates from Sorted Array
Remove duplicates in-place from a sorted array and return the new length. Reddit uses this to test two-pointer fluency — the same pattern they use to dedupe vote events from the same user_id arriving across replicas.
- #5easysometimes asked
5. Remove Element
Remove all occurrences of a target value in-place from an array. Reddit asks this to test in-place mutation patterns used in their server-side comment-tree pruning when a moderator nukes a banned user's history.
- #8easysometimes asked
8. Plus One
Add one to a big integer represented as an array of digits. Reddit asks this to test careful carry-handling — the same kind of mental model needed for monotonic karma counters that survive past 2^31.
- #11easysometimes asked
11. Same Tree
Given two binary trees, determine if they are structurally identical with the same values. Reddit uses this to test recursion fundamentals — the basis for comparing two snapshots of a comment subtree during edit-diff display.
- #12easysometimes asked
12. Symmetric Tree
Determine if a binary tree is a mirror image of itself. Reddit asks this to gauge whether candidates can write paired-pointer recursion — the same skill needed when comparing two views of a comment tree (live vs. cached).
- #14easysometimes asked
14. Balanced Binary Tree
Determine if a binary tree is height-balanced. Reddit uses this to test bottom-up recursion — the same insight that lets them detect comment subtrees that have grown pathologically deep on one side (a fingerprint of bot reply chains).
- #15easysometimes asked
15. Minimum Depth of Binary Tree
Find the minimum depth (root to nearest leaf). Reddit asks this for two-fold reason: it tests careful recursion (one-sided subtrees are a trap) and connects to early-termination patterns in their comment-tree renderer.
- #16easyrarely asked
16. Pascal's Triangle
Generate the first numRows of Pascal's Triangle. Reddit asks this to gauge basic 2D-array fluency — the same iteration pattern they use to build precomputed lookup tables for vote-decay coefficients.
- #18easysometimes asked
18. Valid Palindrome
Determine if a string is a palindrome after removing non-alphanumeric characters and lowercasing. Reddit uses this to test two-pointer technique on dirty input — exactly the kind of normalization their username/subreddit-name validation must handle.
- #19easysometimes asked
19. Single Number
Find the single non-duplicated number in an array where every other number appears twice. Reddit asks this to test bitwise reflexes — the same XOR trick used in their vote-toggle audit (each user vote should appear paired with its undo, except for the active one).
- #22easysometimes asked
22. Two Sum II - Input Array Is Sorted
Find two numbers in a sorted array that sum to a target. Reddit uses this two-pointer variant to test whether candidates recognize when sorting buys them O(1) extra space — relevant for sorted vote-tally pairing.
- #24easysometimes asked
24. Rotate Array
Rotate an array to the right by k steps. Reddit uses the reverse-then-reverse trick to gauge in-place manipulation — the same skill needed to rotate a fixed-size sliding ranking window without re-allocating.
- #25easyrarely asked
25. Reverse Bits
Reverse the bits of a 32-bit unsigned integer. Reddit uses this to test bitwise fluency — the same low-level operation used in their fingerprint-hash byte-swapping (some browsers send hashes in opposite endianness).
- #26easyrarely asked
26. Number of 1 Bits
Count the set bits in a 32-bit integer. Reddit uses this Hamming-weight question to test bitwise tricks — the same primitive used in their feature-flag rollout system where flag-sets are stored as bitmasks.
- #28easyrarely asked
28. Happy Number
Determine if a number reaches 1 under iterated sum-of-squares of digits. Reddit uses this to test cycle detection on derived sequences — the same shape as detecting fingerprint hashes that loop in their bot-detection telemetry.
- #29easyrarely asked
29. Isomorphic Strings
Check if two strings are isomorphic (each character in s can be replaced to get t). Reddit asks this to test bidirectional mapping — the same skill needed for their username-to-ID isomorphism guarantees in cross-shard joins.
- #75easysometimes asked
75. Contains Duplicate
Determine if an array contains duplicate values. Reddit uses this as a hash-set warm-up — the same primitive used to detect duplicate vote events arriving from sharded gateways.
- #76easysometimes asked
76. Contains Duplicate II
Determine if duplicate values exist within k indices apart. Reddit uses this to test sliding-window with hash — the same shape used in their abuse pipeline to detect repeated votes from the same user_id within a short time window.
- #77easysometimes asked
77. Invert Binary Tree
Invert a binary tree (mirror left and right at every node). Reddit asks this canonical question — connects to alternating-view rendering in their right-side-vs-left-side AB tests.
- #83easyrarely asked
83. Intersection of Two Arrays
Return the intersection of two arrays as unique values. Reddit uses this hash-set warm-up to test set operations — the same primitive used to find overlapping users between two subreddits for cross-promotion.
- #84easysometimes asked
84. Move Zeroes
Move zeros to the end while keeping the order of non-zeros. Reddit uses this to test in-place two-pointer technique — the same compact-and-tombstone pattern used when removing soft-deleted comments from a tree without rebuilding it.