Skip to main content

Twilio Coding Interview Questions

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

Showing 25 problems of 25

  • #1easyfoundational

    1. Two Sum

    Two Sum is Twilio's canonical phone-screen warm-up: given an integer array and a target, return the indices of the two numbers that add up to the target. Twilio's bar is that you name the brute-force, the hash-map tradeoff, and walk through duplicate-value edge cases before coding.

    3 free resourcesSolve →
  • #2mediumfrequently asked

    2. Add Two Numbers

    Add Two Numbers gives Twilio interviewers a clean read on your linked-list mechanics: two non-empty lists hold digits in reverse, and you must return the digit-wise sum as a new linked list. The grading rubric weighs carry propagation, unequal lengths, and a trailing carry past both lists.

    3 free resourcesSolve →
  • #3mediumfrequently asked

    3. Longest Substring Without Repeating Characters

    Twilio's classic sliding-window question: given a string, return the length of the longest substring without repeating characters. The grading rubric weighs whether you build the optimal O(n) sliding window with a hash map, not the O(n^2) brute-force scan.

    3 free resourcesSolve →
  • #20easyfoundational

    20. Valid Parentheses

    Valid Parentheses is Twilio's go-to phone-screen stack question: given a string of brackets, decide if every opener is closed by the correct closer in correct order. The rubric grades whether you reach for a stack immediately and handle the three failure modes (wrong closer, unmatched closer, leftover openers).

    3 free resourcesSolve →
  • #21easyfoundational

    21. Merge Two Sorted Lists

    Merge Two Sorted Lists is Twilio's linked-list mechanics check: splice two sorted lists into a single sorted list in O(m + n). The dummy-head pattern is mandatory; candidates who special-case the first node are flagged for handling unnecessary edge cases.

    3 free resourcesSolve →
  • #49mediumfrequently asked

    49. Group Anagrams

    Group Anagrams is Twilio's canonical hash-key-design probe: given an array of strings, group the anagrams together. The grading rubric weighs whether you choose the sorted-string key (simple) or the character-count key (asymptotically faster) and can articulate why each tradeoff matters.

    3 free resourcesSolve →
  • #56mediumcompany favorite

    56. Merge Intervals

    Merge Intervals is Twilio's quintessential time-range problem: given an array of intervals, merge all overlapping ones and return the result. Twilio's voice/messaging teams use this pattern for collapsing call-window or rate-limit-window logs, and the interview grades whether you sort first and merge in O(n).

    3 free resourcesSolve →
  • #121easyfrequently asked

    121. Best Time to Buy and Sell Stock

    Best Time to Buy and Sell Stock is Twilio's running-min phone-screen probe: given an array of daily prices, find the maximum profit from a single buy and a later sell. The grading bar is whether you produce the linear single-pass solution, not the O(n^2) double loop.

    3 free resourcesSolve →
  • #139mediumfrequently asked

    139. Word Break

    Word Break is Twilio's DP-versus-recursion-with-memo probe: given a string s and a dictionary, determine if s can be segmented into a sequence of dictionary words. The grading rubric weighs whether you avoid exponential blowup with memoization or bottom-up DP, and choose a Set lookup for the dictionary.

    3 free resourcesSolve →
  • #146mediumcompany favorite

    146. LRU Cache

    LRU Cache is Twilio's premier system-design coding probe: implement get and put in O(1), with eviction of the least-recently-used entry when capacity is exceeded. Twilio's rate-limiter and rolling-window code paths use this exact data structure, and the interview rubric grades whether you reach for a hash map plus doubly-linked list without prompting.

    4 free resourcesSolve →
  • #155mediumfrequently asked

    155. Min Stack

    Min Stack is Twilio's auxiliary-state-tracking probe: design a stack that supports push, pop, top, and getMin all in O(1). The grading rubric weighs whether you maintain a parallel structure (second stack of running minimums) rather than scanning to compute min on demand.

    3 free resourcesSolve →
  • #200mediumfrequently asked

    200. Number of Islands

    Number of Islands is Twilio's graph-traversal probe: given an m x n grid of '1' (land) and '0' (water), count distinct islands. The grading rubric weighs whether you reach for DFS/BFS to flood-fill or — more impressively — Union-Find for a streaming variant.

    3 free resourcesSolve →
  • #206easyfoundational

    206. Reverse Linked List

    Reverse Linked List is Twilio's pointer-mechanics warm-up: flip a singly-linked list in place and return the new head. The grading bar is whether you write the iterative three-pointer version correctly the first try, with bonus credit for a clean recursive version.

    3 free resourcesSolve →
  • #207mediumfrequently asked

    207. Course Schedule

    Course Schedule is Twilio's cycle-detection probe: given numCourses and a list of prerequisite pairs, decide if all courses can be finished. The grading rubric weighs whether you frame it as 'does the directed graph have a cycle?' and use either Kahn's BFS topological sort or DFS with three-color marking.

    3 free resourcesSolve →
  • #208mediumfrequently asked

    208. Implement Trie (Prefix Tree)

    Implement Trie is Twilio's prefix-tree design probe: build a data structure supporting insert, search, and startsWith over lowercase-letter words. The grading rubric weighs whether you choose the 26-slot child array (fast, fixed memory) or a hash-map child structure (memory-frugal for sparse keysets).

    3 free resourcesSolve →
  • #232easyfrequently asked

    232. Implement Queue using Stacks

    Implement Queue using Stacks is Twilio's amortized-analysis probe: build a FIFO queue using only stack primitives. The grading bar is whether you reach for the two-stack trick (in-stack + out-stack) and articulate the O(1) AMORTIZED guarantee on pop/peek.

    3 free resourcesSolve →
  • #239hardfrequently asked

    239. Sliding Window Maximum

    Sliding Window Maximum is Twilio's monotonic-deque probe: given an array nums and window size k, return the max in every k-length window. The grading rubric weighs whether you avoid the O(n * k) naive scan and reach for the monotonic-decreasing-deque trick that yields O(n).

    3 free resourcesSolve →
  • #253mediumcompany favorite

    253. Meeting Rooms II

    Meeting Rooms II is Twilio's resource-scheduling probe: given a list of meeting time intervals, return the minimum number of rooms required. Twilio's voice-team interview reports frame this as 'minimum concurrent call legs' — the algorithmic shape is identical. The grading bar is the sort-and-sweep with min-heap (or two sorted arrays) for O(n log n).

    3 free resourcesSolve →
  • #347mediumfrequently asked

    347. Top K Frequent Elements

    Top K Frequent Elements is Twilio's data-aggregation probe: given an integer array, return the K most frequent values. The grading rubric weighs whether you reach for a min-heap of size K (O(n log K)) or bucket sort (O(n)), and articulate WHY the second is faster when the value range is bounded by n.

    3 free resourcesSolve →
  • #355mediumfrequently asked

    355. Design Twitter

    Design Twitter is Twilio's feed-system probe: implement postTweet, follow, unfollow, and getNewsFeed (the 10 most recent tweets from a user and the people they follow). The grading rubric weighs whether you choose a fan-out-on-read model with K-way merge for the feed or fan-out-on-write, and articulate the tradeoff.

    3 free resourcesSolve →
  • #359easycompany favorite

    359. Logger Rate Limiter

    Logger Rate Limiter is Twilio's signature rate-limit warm-up: implement shouldPrintMessage(timestamp, message) that returns true iff the message hasn't been printed in the last 10 seconds. Twilio's API-platform interviews use this as the entry point to the full rate-limiter design family. The grading bar is the hash-map approach with O(1) per call.

    3 free resourcesSolve →
  • #362mediumcompany favorite

    362. Design Hit Counter

    Design Hit Counter is Twilio's rolling-window probe: track the number of hits received in the past 300 seconds. The grading rubric weighs whether you use a bounded 300-bucket array (memory-efficient regardless of request rate) or a queue (flexible but unbounded under high load), and articulate the tradeoff.

    3 free resourcesSolve →
  • #560mediumfrequently asked

    560. Subarray Sum Equals K

    Subarray Sum Equals K is Twilio's prefix-sum probe: given an integer array and target k, count the contiguous subarrays whose sum equals k. The grading rubric weighs whether you reach for the prefix-sum-plus-hash-map trick to drop from O(n^2) to O(n), and articulate why two equal prefix sums imply a zero-sum subarray.

    3 free resourcesSolve →
  • #706easyfrequently asked

    706. Design HashMap

    Design HashMap is Twilio's data-structure-from-scratch probe: implement put, get, and remove without using any built-in hash table. The grading bar is the chained-bucket design — modulo-bucket + linked-list-of-(key,value) — with explicit collision handling.

    3 free resourcesSolve →
  • #1242mediumfrequently asked

    1242. Web Crawler Multithreaded

    Web Crawler Multithreaded is Twilio's concurrency probe: crawl all URLs reachable from a startUrl that share the same hostname, returning the list. Twilio's API-platform team uses this to grade concurrent BFS, work-distribution, and visited-set synchronization. The grading bar is a thread-safe visited set plus a work-stealing queue or async pool.

    3 free resourcesSolve →
Twilio Coding Interview Questions — Full Solutions — InterviewChamp.AI