Twitch interview questions & answers

10 real Twitch interview questions with full model answers — Coding, Product & growth, Technical. Drawn from the same verified bank ChannelPulse drills from (10 Twitch questions in total).

CodingEasyTwitchSoftware Engineer

1. Reverse Vowels of a String (LeetCode)

Model answer

The task

Given a string, return a new string with its vowels in reverse order. Keep every non-vowel character in its original position, and treat uppercase and lowercase vowels alike.

Key idea

Use two pointers, one at each end of the string. Move each pointer inward until it finds a vowel, then swap those vowels and continue.

Approach

  1. Convert the string to a list so its characters can be swapped.
  2. Put one pointer at the start and the other at the end.
  3. Advance the left pointer past non-vowels; retreat the right pointer past non-vowels.
  4. Swap the vowels when both pointers stop, then move both inward.
  5. Join the characters into the result.
class Solution:
    def reverseVowels(self, s: str) -> str:
        vowels = set("aeiouAEIOU")
        chars = list(s)
        left, right = 0, len(chars) - 1

        while left < right:
            while left < right and chars[left] not in vowels:
                left += 1
            while left < right and chars[right] not in vowels:
                right -= 1

            chars[left], chars[right] = chars[right], chars[left]
            left += 1
            right -= 1

        return "".join(chars)

Complexity:

  • Time: O(n), since the pointers traverse the string at most once.
  • Space: O(n), for the character list used to build the result.

Common follow-ups

  • How would you handle a different definition of vowels? Change the membership set to match it.
  • Can the method avoid creating a character list? Not for an immutable Python string; a mutable buffer would be needed.
  • What if there are no vowels or only one vowel? The pointers never swap distinct positions, so the string is returned unchanged.
CodingEasyTwitchSoftware Engineer

2. Create a Session Bar Chart (LeetCode)

Model answer

The task

The title suggests summarizing session records into duration groups and showing how many sessions fall in each group. The exact schema, duration units, and bucket boundaries are not specified, so the query below is a template rather than an exact submission.

Key idea

Assign each session to a bucket, count sessions per bucket, and return the buckets in order. A charting tool can use those counts as the bar heights.

Approach

  1. Choose a duration column and a positive bucket width that match the data.
  2. Convert each duration to a bucket index.
  3. Count records in each bucket.
  4. Sort by bucket index so the results can be plotted in order.
-- Template: replace session_records and duration with the actual
-- table and column names. Supply :bucket_width in the duration's units.
WITH bucketed_sessions AS (
    SELECT
        FLOOR(duration / :bucket_width) AS bucket_index
    FROM session_records
)
SELECT
    bucket_index,
    COUNT(*) AS session_count
FROM bucketed_sessions
GROUP BY bucket_index
ORDER BY bucket_index;

Complexity:

  • Time: O(n) average for scanning and grouping n sessions; sorting the k output buckets may add O(k log k).
  • Space: O(k) for the grouped bucket counts.

Common follow-ups

  • How would you label each bar? Return the bucket’s lower and upper bounds alongside its count.
  • What if the chart needs empty buckets too? Generate the full bucket range and left join the counts.
  • What if durations are highly skewed? Use logarithmic buckets or cap the displayed range and group the tail.
CodingMediumTwitchSoftware Engineer

3. Design a File Sharing System (LeetCode)

Model answer

The task

Design a file-sharing service that tracks which users own each chunk. Users can join with chunks, leave, or request a chunk; a request returns its current owners and gives the requester a copy if any exist.

Key idea

Maintain ownership in both directions: from each chunk to its owners, and from each user to their chunks. Allocate the smallest available user ID with a min-heap, reusing IDs after users leave.

Approach

  1. Store each user’s chunks and each chunk’s owners in sets.
  2. On join, reuse the smallest freed ID or assign the next new ID, then record the supplied chunks.
  3. On leave, remove the user from every chunk they own and add their ID to the free-ID heap.
  4. On request, return the sorted owners before adding the requester. If there are no owners, return an empty list and do not grant the chunk.
from collections import defaultdict
import heapq
from typing import Iterable

class FileSharing:
    def __init__(self, m: int):
        self.m = m
        self.next_id = 1
        self.free_ids = []

        self.user_chunks = {}
        self.chunk_owners = defaultdict(set)

    def join(self, ownedChunks: Iterable[int]) -> int:
        if self.free_ids:
            user_id = heapq.heappop(self.free_ids)
        else:
            user_id = self.next_id
            self.next_id += 1

        chunks = set(ownedChunks)
        self.user_chunks[user_id] = chunks
        for chunk_id in chunks:
            self.chunk_owners[chunk_id].add(user_id)

        return user_id

    def leave(self, userID: int) -> None:
        chunks = self.user_chunks.pop(userID)
        for chunk_id in chunks:
            self.chunk_owners[chunk_id].remove(userID)
        heapq.heappush(self.free_ids, userID)

    def request(self, userID: int, chunkID: int) -> list[int]:
        owners = self.chunk_owners[chunkID]
        if not owners:
            return []

        current_owners = sorted(owners)
        owners.add(userID)
        self.user_chunks[userID].add(chunkID)
        return current_owners

Complexity:

  • Time: join and leave are O(k) average, where k is the number of chunks affected; request is O(d log d), where d is the number of current owners.
  • Space: O(U + C), for stored user-chunk ownership relations and freed IDs.

Common follow-ups

  • How can requests avoid sorting every time? Keep owners in an ordered set, trading simpler reads for more complex updates.
  • How would you handle concurrent joins or requests? Protect ID allocation and ownership updates with locks or transactions.
  • What if chunks are replicated across regions? Track ownership per region and coordinate updates through a consistent service.
CodingMediumTwitchSoftware Engineer

4. LRU Cache (LeetCode)

Model answer

The task

Design a cache with a fixed capacity that supports retrieving and inserting key-value pairs. When an insertion exceeds capacity, evict the item that has gone unused for the longest time.

Key idea

Use a hash map for direct key lookup and a doubly linked list to track recency. Keep the most recently used item at the front; the least recently used item is at the back.

Approach

  1. Create a map from keys to their linked-list nodes.
  2. Use dummy head and tail nodes so items can be added or removed without special cases at the ends.
  3. On a successful get, move the node to the front and return its value; return -1 if the key is absent.
  4. On put, update and promote an existing node, or add a new node at the front.
  5. If the cache is over capacity, remove the node just before the tail and delete its key from the map.
class _Node:
    def __init__(self, key: int = 0, value: int = 0):
        self.key = key
        self.value = value
        self.prev = None
        self.next = None

class LRUCache:
    def __init__(self, capacity: int):
        self.capacity = capacity
        self.nodes = {}

        # Items are stored between these sentinels.
        self.head = _Node()
        self.tail = _Node()
        self.head.next = self.tail
        self.tail.prev = self.head

    def _remove(self, node: _Node) -> None:
        node.prev.next = node.next
        node.next.prev = node.prev

    def _add_to_front(self, node: _Node) -> None:
        node.prev = self.head
        node.next = self.head.next
        self.head.next.prev = node
        self.head.next = node

    def _make_most_recent(self, node: _Node) -> None:
        self._remove(node)
        self._add_to_front(node)

    def get(self, key: int) -> int:
        node = self.nodes.get(key)
        if node is None:
            return -1

        self._make_most_recent(node)
        return node.value

    def put(self, key: int, value: int) -> None:
        node = self.nodes.get(key)

        if node is not None:
            node.value = value
            self._make_most_recent(node)
            return

        node = _Node(key, value)
        self.nodes[key] = node
        self._add_to_front(node)

        if len(self.nodes) > self.capacity:
            least_recent = self.tail.prev
            self._remove(least_recent)
            del self.nodes[least_recent.key]

Complexity:

  • Time: O(1) for get and put; map and list operations take constant time.
  • Space: O(capacity); the map and list store at most the cache’s capacity of entries.

Common follow-ups

  • How would you make the cache thread-safe? Protect operations with a lock.
  • What if entries expire after a time-to-live? Track expiration times and remove expired entries during access or with a cleanup mechanism.
  • How would you support eviction by frequency instead of recency? Track access counts and organize entries by frequency.
CodingMediumTwitchSoftware Engineer

5. Toss Strange Coins (LeetCode)

Model answer

The task

Given independent coins with different probabilities of landing heads, compute the probability that exactly target coins land heads.

Key idea

Use dynamic programming to track the probability of getting each possible number of heads after processing some coins. For each coin, either it adds a head or it does not; update counts in descending order so each coin is used only once.

Approach

  1. Let dp[j] be the probability of exactly j heads among the coins processed so far.
  2. Initialize dp[0] = 1: before tossing any coins, zero heads is certain.
  3. For each coin, update dp[j] using the probabilities of getting j heads with tails, or j - 1 heads followed by heads.
  4. Update dp[0] for the chance that the coin lands tails.
  5. Return the probability for target; if it exceeds the number of coins, return zero.
from typing import List

class Solution:
    def probabilityOfHeads(self, prob: List[float], target: int) -> float:
        n = len(prob)
        if target > n:
            return 0.0

        # dp[j] is the probability of exactly j heads so far.
        dp = [0.0] * (target + 1)
        dp[0] = 1.0

        for i, p in enumerate(prob):
            # Descending order preserves values from before this coin.
            for heads in range(min(target, i + 1), 0, -1):
                dp[heads] = dp[heads] * (1.0 - p) + dp[heads - 1] * p

            # With zero heads so far, this coin must land tails.
            dp[0] *= 1.0 - p

        return dp[target]

Complexity:

  • Time: O(n × target), updating at most target probabilities per coin.
  • Space: O(target), storing probabilities for each relevant head count.

Common follow-ups

  • How would you compute the probability of at least target heads? Sum dp[j] for all j >= target.
  • How can you reduce work when target is much larger than the number of coins? Return zero immediately, as the solution does.
  • What if the coins are not independent? The recurrence no longer applies directly; model their joint outcomes or conditional probabilities.
CodingMediumTwitchSoftware Engineer

6. Merge Intervals (LeetCode)

Model answer

The task

Given a collection of intervals, combine every pair that overlaps and return the resulting non-overlapping intervals. The result should be ordered by starting point.

Key idea

Sort intervals by their start. Then scan once, keeping the most recently merged interval; each next interval either extends it or starts a new one.

Approach

  1. Sort the intervals by their start value.
  2. Initialize the result with the first interval, if any.
  3. For each remaining interval, compare its start with the end of the last result interval.
  4. If they overlap, update that end to the larger of the two ends.
  5. Otherwise, append the interval as a new result.
from typing import List

class Solution:
    def merge(self, intervals: List[List[int]]) -> List[List[int]]:
        if not intervals:
            return []

        intervals.sort(key=lambda interval: interval[0])
        merged = [intervals[0]]

        for start, end in intervals[1:]:
            # The intervals overlap, so extend the last merged interval.
            if start <= merged[-1][1]:
                merged[-1][1] = max(merged[-1][1], end)
            else:
                # No overlap: this interval begins a new merged range.
                merged.append([start, end])

        return merged

Complexity: Time: O(n log n), dominated by sorting n intervals.

Complexity: Space: O(n) for the merged result; sorting may also use up to O(n) space.

Common follow-ups

  • What if intervals that only touch at an endpoint should remain separate? Use start < merged[-1][1] as the overlap test.
  • How would you merge intervals as they arrive in sorted order? Skip sorting and apply the same scan, processing each interval once.
  • What if intervals are inserted one at a time into an already merged collection? Use binary search to find the insertion point, then merge neighboring overlaps.
CodingMediumTwitchData Scientist

7. You are given an m by n matrix with with 0s and 1s, where a 1 represents an obstacle and a 0 represents no obstacle.

The full question

You are given an m by n matrix with with 0s and 1s, where a 1 represents an obstacle and a 0 represents no obstacle. Determine the number of ways to navigate from the top-left corner of the matrix to the bottom right corner given that at any point in time there is only a move down or to the right as long as there is not an obstacle in that spot.

For example, if the matrix is given by: [[0, 0, 0], [1, 1, 0], [0, 1, 0]] then you should return 1 since there is exactly one path.

Model answer

function countPaths(grid) {
  // Return 0 for an empty or malformed grid.
  if (!Array.isArray(grid) || grid.length === 0 || !Array.isArray(grid[0]) || grid[0].length === 0) {
    return 0;
  }

  const rows = grid.length;
  const cols = grid[0].length;
  const paths = Array(cols).fill(0);

  // A blocked start or destination cannot be part of any valid path.
  if (grid[0][0] === 1 || grid[rows - 1][cols - 1] === 1) {
    return 0;
  }

  paths[0] = 1;

  for (let row = 0; row < rows; row++) {
    for (let col = 0; col < cols; col++) {
      if (grid[row][col] === 1) {
        paths[col] = 0; // No path can pass through this cell.
      } else if (col > 0) {
        paths[col] += paths[col - 1]; // From above plus from the left.
      }
    }
  }

  return paths[cols - 1];
}

const grid = [[0, 0, 0], [1, 1, 0], [0, 1, 0]];
console.log(countPaths(grid)); // 1
  • paths[col] stores the number of ways to reach the current cell from above; paths[col - 1] is the number from the left.
  • A blocked cell resets its count to zero, preventing paths from passing through it.

Complexity: Time O(mn); space O(n).

CodingHardTwitchSoftware Engineer

8. Find Median from Data Stream (LeetCode)

Model answer

The task

Design a data structure that accepts numbers one at a time and can return the median of all numbers seen so far. The median is the middle value for an odd count, or the average of the two middle values for an even count.

Key idea

Keep the lower half of the values in a max-heap and the upper half in a min-heap. Maintain heap sizes so the lower half has either the same number of elements as the upper half or exactly one more.

Approach

  1. Store the lower half as negated values in Python’s min-heap; store the upper half normally.
  2. Insert each new value into the lower heap.
  3. Move the largest lower-half value to the upper heap to preserve ordering.
  4. If the upper heap becomes larger, move its smallest value back to the lower heap.
  5. Return the lower heap’s top for an odd count, or average the two heap tops for an even count.
import heapq

class MedianFinder:
    def __init__(self):
        # Negated values make this a max-heap.
        self.lower = []
        # A regular min-heap.
        self.upper = []

    def addNum(self, num: int) -> None:
        heapq.heappush(self.lower, -num)

        # Ensure every value in lower is <= every value in upper.
        largest_lower = -heapq.heappop(self.lower)
        heapq.heappush(self.upper, largest_lower)

        # Keep lower the same size as upper, or one element larger.
        if len(self.upper) > len(self.lower):
            smallest_upper = heapq.heappop(self.upper)
            heapq.heappush(self.lower, -smallest_upper)

    def findMedian(self) -> float:
        if len(self.lower) > len(self.upper):
            return float(-self.lower[0])

        return (-self.lower[0] + self.upper[0]) / 2.0

Complexity:

  • Time: addNum is O(log n) due to heap operations; findMedian is O(1).
  • Space: O(n) to store all numbers across the two heaps.

Common follow-ups

  • How would you support removing values? Use lazy deletion with delayed removals, pruning heap tops as needed.
  • What if numbers arrive in a bounded integer range? A frequency array can track counts and locate the middle ranks.
  • Can this be distributed across machines? Maintain ordered partitions or quantile summaries, then combine counts to find the middle ranks.
Product & growthMediumTwitchProduct Manager

9. List a few improvements for any product.

The full question

List a few improvements for any product.

We'll be using Evernote for this example.

Make it harder? Offer at least three unique improvements.

Model answer

Clarify & scope

I’ll focus on Evernote’s core job: helping people capture information, find it later, and turn it into useful work. I’ll assume the primary audience is individual knowledge workers, while keeping improvements compatible with team use.

User segments & pain points

My primary segment is people who collect notes across meetings, web pages, and devices. Their biggest pain is not taking a note—it’s reliably retrieving the right detail months later. They also lose time when capturing content requires too many steps or when notes are disconnected from the work they support.

Goals & success metrics

The North Star would be weekly users who successfully retrieve or reuse a saved note. I’d track time to first useful search result, search-to-open rate, repeat use of notes, and successful capture rate. Guardrails would include sync failures, search abandonment, accidental sharing, and unsubscribe or churn rates.

Solutions

  1. Make capture nearly effortless: Add a unified quick-capture action for text, voice, photos, and links, with automatic source, date, and meeting context. This helps users save information before they lose it.
  2. Improve retrieval with semantic search: Let users search in natural language—such as “the feedback from my design review last spring”—and show matching passages with the notebook, date, and source. Keep keyword search available and clearly distinguish generated summaries from original notes.
  3. Connect notes to action: Offer optional reminders and lightweight task extraction from meeting notes, with a review step before creating tasks. This turns stored information into follow-through without silently changing a user’s notes.

Recommendation: I’d start with semantic retrieval. It addresses a central, frequent frustration, benefits users with large existing libraries, and can increase the value of content they have already captured.

Prioritization & trade-offs

Using impact, confidence, and effort as a lightweight RICE check, retrieval likely ranks first: high user impact and broad reach, with meaningful engineering and evaluation effort. Quick capture is a strong second. Automatic task extraction has more privacy and accuracy risk, so I’d validate it later and make it opt-in.

MVP, measurement & rollout

I’d launch semantic search to a small opt-in cohort, evaluate it against keyword search on representative queries, and expand only if search-to-open and successful retrieval improve without increasing abandonment or privacy concerns. I’d use an in-product feedback prompt for failed searches and review those queries weekly to guide iteration.

TechnicalMediumTwitchSoftware Engineer

10. Describe what happens when you type a URL into your browser and press Enter.

Model answer

  1. Parse and validate the URL. The browser determines the scheme, hostname, port, path, and query parameters. It applies policies such as HSTS, which can upgrade an HTTP URL to HTTPS, and may check for a matching service worker or cached response.
  2. Resolve the hostname. The browser checks its DNS cache and the operating system’s cache before asking a configured resolver. DNS returns an IP address; the result may point to a CDN or load balancer rather than the origin server.
  3. Establish a connection. The browser reuses an eligible connection when possible. Otherwise, it connects to the server using TCP for HTTP/1.1 or HTTP/2, or QUIC for HTTP/3. For HTTPS, it negotiates TLS, validates the certificate and hostname, and agrees on encryption settings and, where applicable, the HTTP protocol.
  4. Send the HTTP request. The browser sends a request containing the method, path, headers, and any body. Headers can include cookies, authentication, and cache validators. Proxies, CDNs, and the origin may handle the request; a redirect can cause the browser to repeat navigation to another URL.
  5. Receive and process the response. The response includes a status code, headers, and content. The browser applies cache rules and security policies, then parses HTML into the DOM. It parses CSS into the CSSOM, builds a render tree, computes layout, and paints pixels to the screen.
  6. Load dependencies and run scripts. HTML can reference images, stylesheets, fonts, and JavaScript, which trigger additional requests. Scripts may block parsing unless marked async or defer; JavaScript can also change the DOM and trigger more rendering or network activity. The page becomes interactive as required resources and event handlers are ready, though loading can continue afterward.
flowchart TD
    A[Enter URL] --> B[Parse URL and apply policies]
    B --> C{Usable cache or service worker response?}
    C -->|Yes| H[Process response]
    C -->|No| D[Resolve hostname with DNS]
    D --> E[Connect using TCP or QUIC]
    E --> F[Negotiate TLS for HTTPS]
    F --> G[Send HTTP request through edge to origin]
    G --> H
    H --> I[Parse HTML, CSS, and scripts]
    I --> J[Request dependent resources]
    J --> K[Layout, paint, and become interactive]
Diagram

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions