Skip to main content

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 34 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.

  • #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.

  • #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.

  • #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.

  • #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.

  • #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).

  • #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.

  • #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.

  • #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.

  • #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).

  • #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.

  • #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.

  • #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).

  • #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.

  • #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.

  • #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.

Reddit Coding Interview Questions — Full Solutions — InterviewChamp.AI