← TikTok Interview Insights

TikTok·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

TikTok DS interview, SQL-heavy round focused on their Live product. Three questions total, escalating difficulty, all around the same schema. The hard one at the end was genuinely tricky and I'm not sure I nailed it.

Questions Asked (3)

Q1

Given a Live sessions table and an activity table, for the first week of October 2022 in the US, how many distinct creators launched more than 3 mobile Live sessions?

Product Analytics & MetricsData Modeling
Author's notes

Pretty straightforward filter-and-count.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and definitions (e.g., what constitutes a 'Live session', how to identify mobile sessions, and how to define 'first week of October 2022' and 'US'). Then, write a SQL query that filters sessions by date range, country, and device type, groups by creator, counts distinct sessions, and finally filters creators with more than 3 sessions. Validate assumptions and consider edge cases like time zones and session boundaries.

Pro tip: Mention that you would confirm whether 'first week' means Oct 1-7 or the first full week (e.g., Oct 3-9) and whether 'mobile' includes tablets. Also, discuss how to handle sessions that span midnight or cross week boundaries.

1. Clarify Requirements and Definitions

Ask clarifying questions to define key terms: 'Live session', 'mobile', 'first week of October 2022', 'US', and 'distinct creators'. Confirm the date range and whether to include sessions that start before but end within the week.

2. Explore Table Schemas

Identify relevant columns in the Live sessions and activity tables, such as creator_id, session_id, start_time, end_time, device_type, country, and any join keys. Determine how to link tables if needed.

3. Filter and Aggregate Sessions

Write a subquery to filter sessions by date range (first week of Oct 2022), country = 'US', and device_type = 'mobile'. Group by creator_id and count distinct session_id to get the number of sessions per creator.

4. Apply Threshold and Count Creators

From the aggregated result, filter creators with session count > 3, then count the distinct creators to get the final answer.

5. Validate and Discuss Edge Cases

Sanity-check results (e.g., total sessions, distribution) and discuss potential pitfalls like time zone conversions, session overlap, or missing data. Suggest alternative interpretations if needed.

Key Points to Mention

  • Definition of 'first week': clarify if it's Oct 1-7 or the first full week (e.g., Oct 3-9) and whether to use UTC or local time.
  • Mobile detection: specify how to identify mobile sessions (e.g., device_type = 'mobile', or platform in ('iOS', 'Android')).
  • Distinct sessions: ensure counting distinct session_id to avoid duplicates.
  • Join logic: if the activity table is needed, explain how to join (e.g., on session_id or creator_id) and whether to use INNER JOIN or LEFT JOIN.
  • Time zone handling: consider converting timestamps to US time zones or using UTC consistently.
  • Edge cases: sessions spanning midnight, creators with sessions outside the week, and data quality issues (e.g., null device_type).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

For October 2022, find the top 5 creators by total gifts received within each country. Handle ties deterministically.

Product Analytics & MetricsData ModelingAlgorithms & Data Structures
Author's notes

The ranking part is where people trip up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, filter the gift transactions to October 2022 and aggregate total gifts received per creator per country. Then, within each country, rank creators by total gifts descending and select the top 5, using a deterministic tie-breaker such as creator ID ascending. Finally, output the results grouped by country.

Pro tip: Explicitly state your tie-breaking rule (e.g., 'ties broken by creator ID ascending') and mention that you would validate the results by checking for duplicate creators per country and ensuring exactly 5 rows per country where possible.

1. Filter and aggregate

Filter the transaction data to October 2022 and compute the sum of gifts received for each creator within each country.

2. Rank within each country

For each country, rank creators by total gifts in descending order. Apply a deterministic tie-breaker, such as creator ID ascending, to ensure consistent ordering.

3. Select top 5 per country

From the ranked list, pick the top 5 creators for each country. If there are fewer than 5 creators, include all.

4. Validate and format output

Check that each country has at most 5 creators and no duplicates. Format the final result with country, creator ID, and total gifts.

Key Points to Mention

  • Date filtering: use transaction date between '2022-10-01' and '2022-10-31' inclusive.
  • Aggregation: sum gifts per creator per country, handling possible nulls or zero values.
  • Deterministic tie-breaking: specify a rule like creator ID ascending when total gifts are equal.
  • Window functions: use ROW_NUMBER() or RANK() with PARTITION BY country ORDER BY total_gifts DESC, creator_id ASC.
  • Edge cases: countries with fewer than 5 creators, ties at the 5th position, and data quality issues.
  • Output format: include country, creator ID, and total gifts, sorted by country and rank.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

For yesterday's date, count creators who went live at least twice AND had every single one of their rooms that day watched by 500 or more viewers.

Product Analytics & MetricsData Modeling
Author's notes

The 'every room must satisfy the condition' part is what makes this hard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the definitions of 'creator', 'went live', 'room', and 'watched by 500 or more viewers' to ensure alignment. Then outline a SQL-based approach that aggregates live sessions per creator per day, filters for creators with at least two sessions, and checks that the minimum viewer count across all their rooms is >= 500. Finally, count the distinct creators meeting both conditions.

Pro tip: Mention the importance of handling edge cases like null viewer counts, multiple rooms per session, and timezone considerations for 'yesterday's date'. Also, discuss how to optimize the query for performance on large datasets, such as using window functions or subqueries.

1. Clarify Requirements

Ask clarifying questions to define key terms: what constitutes a 'creator', a 'live session', a 'room', and how 'watched by 500 or more viewers' is measured (e.g., peak concurrent viewers, unique viewers, average viewers). Confirm the date range for 'yesterday' and timezone.

2. Identify Data Sources

Determine which tables contain live session data, creator information, and viewer metrics. Typically, there would be a sessions table with creator_id, session_id, start_time, and a viewers table or a column with viewer counts per session.

3. Aggregate Sessions per Creator

For the given date, group by creator_id and count the number of live sessions (or rooms). Filter to only creators with count >= 2. Simultaneously, compute the minimum viewer count across all their sessions for that day.

4. Apply Viewer Threshold

From the aggregated results, filter to creators whose minimum viewer count is >= 500. This ensures every room had at least 500 viewers.

5. Count and Validate

Count the distinct creators that satisfy both conditions. Validate the result by checking edge cases, such as creators with exactly two sessions, and ensure no double-counting due to multiple rooms per session.

Key Points to Mention

  • Definition of 'went live' and whether it includes scheduled or only actual live sessions.
  • Handling of multiple rooms per live session: does each room count separately?
  • Viewer metric: peak concurrent viewers vs. unique viewers vs. average viewers.
  • Time zone and date boundaries for 'yesterday'.
  • SQL techniques: using GROUP BY, HAVING, and window functions for efficient filtering.
  • Data quality: dealing with nulls, duplicates, and ensuring accurate counts.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.