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 32 problems of 100
- #27mediumsometimes asked
27. House Robber
Maximize sum from non-adjacent array elements. Reddit asks this to test DP intuition — the same pattern used in their abuse system to select non-adjacent (non-similar) accounts when applying rate-limiting waves.
- #33mediumsometimes asked
33. Longest Palindromic Substring
Find the longest palindromic substring of a string. Reddit asks this to test expand-around-centers — the same pattern used in their similarity-detection between post titles (mirror-image substring matching for spam detection).
- #36mediumsometimes asked
36. Letter Combinations of a Phone Number
Generate all letter combinations from a phone-keypad number string. Reddit uses this backtracking problem to test recursive enumeration — the same shape they'd use to enumerate all tag-permutations for ad targeting.
- #38mediumsometimes asked
38. Generate Parentheses
Generate all combinations of n pairs of well-formed parentheses. Reddit uses this backtracking problem to test pruning skills — the same shape they'd use to enumerate valid markdown nesting structures during comment rendering.
- #39mediumsometimes asked
39. Swap Nodes in Pairs
Swap every two adjacent nodes in a linked list. Reddit asks this to test multi-pointer manipulation — the same pattern needed when re-ordering pairs of items in their ranked feed during an A/B test.
- #40mediumrarely asked
40. Next Permutation
Compute the lexicographically next permutation in-place. Reddit asks this rare problem to test in-place manipulation under a non-obvious algorithm — connects to enumerating moderator action sequences in their audit trail.
- #42mediumsometimes asked
42. Find First and Last Position of Element in Sorted Array
Find the first and last index of a target in a sorted array. Reddit asks this to test bound-based binary search — the same shape used when querying their time-bucketed vote logs for the range of events matching a timestamp.
- #43mediumrarely asked
43. Valid Sudoku
Determine if a 9x9 Sudoku board configuration is valid. Reddit uses this to test multi-key hash-set technique — the same shape used when validating that a moderator action is consistent across multiple constraint sets (subreddit + user + action).
- #44mediumsometimes asked
44. Combination Sum
Find all unique combinations of candidates that sum to target (with repetition). Reddit uses this to test backtracking — the same pattern they'd use to enumerate sets of moderation actions that combine to a desired outcome.
- #45mediumrarely asked
45. Combination Sum II
Find all unique combinations where each candidate is used at most once. Reddit uses this variant to test dedup with duplicates — the same skill needed when uniquifying overlapping abuse signals (each user-IP fingerprint appears at most once per detection batch).
- #46mediumrarely asked
46. Multiply Strings
Multiply two big integers represented as strings. Reddit asks this to test grade-school multiplication translated to code — the same shape used in their cross-shard counter merging where each shard returns a digit-encoded partial sum.
- #47mediumsometimes asked
47. Permutations
Generate all permutations of distinct integers. Reddit uses this to test backtracking — the same pattern they'd use to enumerate orderings of A/B test variants for users.
- #48mediumsometimes asked
48. Rotate Image
Rotate an n x n matrix 90 degrees clockwise in-place. Reddit asks this to test the transpose-then-reverse trick — the same building block they use when re-orienting heatmap matrices for moderator dashboards.
- #50mediumsometimes asked
50. Spiral Matrix
Traverse a matrix in spiral order. Reddit uses this to test boundary tracking — the same skill needed when iterating around 2D region tiles in their image-grid rendering for AR/AR filters.
- #51mediumsometimes asked
51. Jump Game
Determine if you can reach the last index of an array starting from index 0. Reddit asks this to test greedy intuition — the same forward-reachability check used in their dependency-resolution for ad-pixel firing order.
- #53mediumsometimes asked
53. Unique Paths
Count the number of paths from top-left to bottom-right of an m x n grid (right/down only). Reddit uses this DP problem as a clean grid-DP warm-up before harder routing problems.
- #54mediumsometimes asked
54. Minimum Path Sum
Find the path from top-left to bottom-right with minimum sum (right/down only). Reddit uses this to extend grid DP with weights — the same routing pattern they'd use to minimize CDN-cost for inter-region replication.
- #55mediumsometimes asked
55. Simplify Path
Simplify a Unix-style absolute file path. Reddit uses this string + stack problem to test parsing — the same pattern they apply when canonicalizing /r/sub/comments/abc/comment/xyz URLs for cache keying.
- #56mediumsometimes asked
56. Set Matrix Zeroes
If an element in an m x n matrix is 0, zero out its entire row and column. Reddit uses this to test in-place 2D manipulation under a tight memory budget — the same shape they'd use to scrub rows/columns of an analytics matrix when a user is GDPR-deleted.
- #57mediumsometimes asked
57. Search a 2D Matrix
Search a sorted 2D matrix where each row is sorted and each row's first > previous row's last. Reddit uses this to test the 1D-binary-search-on-flattened-matrix trick.
- #58mediumsometimes asked
58. Sort Colors
Sort an array containing only 0s, 1s, and 2s in-place (Dutch national flag). Reddit uses this to test the three-pointer partition — the same shape used when bucketing items into three priority lanes in their ranking pipeline.
- #59mediumrarely asked
59. Combinations
Generate all combinations of k numbers from 1 to n. Reddit uses this to test backtracking with start-index — the same enumeration shape they'd use when picking k subreddits for an admin notification A/B test.
- #61mediumsometimes asked
61. Word Search
Check if a word exists in a 2D character grid (adjacent cells, no reuse). Reddit uses this to test DFS with backtracking on grids — the same shape used in their image-grid content-moderation when scanning for embedded text patterns.
- #62mediumrarely asked
62. Remove Duplicates from Sorted Array II
Allow at most two occurrences of each value in a sorted array, in-place. Reddit uses this to test slow/fast pointer with a count threshold — the same shape as rate-limiting to N per user in their abuse pipeline.
- #63mediumsometimes asked
63. Decode Ways
Count the number of ways to decode a digit string to letters (A=1..Z=26). Reddit uses this DP problem to test recurrence design — the same shape used in their tokenizer when a sequence of input bytes has multiple valid prefix interpretations.
- #65mediumsometimes asked
65. Binary Tree Zigzag Level Order Traversal
Return zigzag level-order traversal of a binary tree. Reddit asks this as a BFS variation to test deque vs. queue intuition — relevant for their alternating-direction rendering pattern in certain UI experiments.
- #66mediumsometimes asked
66. Construct Binary Tree from Preorder and Inorder Traversal
Rebuild a binary tree from preorder and inorder traversals. Reddit uses this to test tree-recursion with index management — the same skill used in their comment-tree audit where they must reconstruct the original tree from serialized snapshots.
- #72mediumsometimes asked
72. Course Schedule II
Return any valid course order given prerequisites. Reddit uses this topo-sort problem to validate dependency-graph linearization — the same shape used when scheduling a chain of database migrations.
- #78mediumsometimes asked
78. Kth Smallest Element in a BST
Find the kth smallest in a BST. Reddit uses this to test inorder + early termination — relevant for ranked-paginated retrieval from an in-memory BST of upvote scores.
- #82mediumsometimes asked
82. Coin Change
Find the minimum number of coins to make a target amount. Reddit uses this DP problem to test classic unbounded-knapsack — the same shape used when computing minimum SQL queries to satisfy a multi-resource quota.
- #85mediumsometimes asked
85. Longest Increasing Subsequence
Find the length of the longest strictly increasing subsequence. Reddit uses this to test DP + binary search — relevant when finding the longest monotonically increasing run in a vote stream (a bot-detection signal).
- #86mediumsometimes asked
86. Reverse Words in a String
Reverse the order of words in a string. Reddit uses this string-manipulation question to test pointer fluency — the same shape used when normalizing search query terms in their suggest service.