← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Meta data science interview with a SQL-style analytical question about user behavior. Pretty lean on context but the problem itself is a classic graph/aggregation type.

Questions Asked (1)

Q1

Write a query to find the number of users who made calls to three or more distinct people within the past week.

Product Analytics & MetricsAlgorithms & Data Structures
Author's notes

Seemed straightforward at first but you have to be careful about counting distinct recipients, not just total calls.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the schema and definitions (e.g., what constitutes a call, how to handle multiple calls to the same person, and the exact time window). Then write a SQL query that filters calls from the past week, counts distinct recipients per caller, and selects those with 3 or more distinct recipients.

Pro tip: Mention that you would verify the time window boundaries (e.g., using 'now() - interval '7 days'') and consider time zones if the data is stored in UTC. Also, discuss how to handle edge cases like null recipients or calls to oneself.

1. Clarify requirements and schema

Ask about the table structure (e.g., call logs with caller_id, recipient_id, timestamp) and define 'past week' (e.g., last 7 days from current time). Confirm whether multiple calls to the same person count as one distinct recipient.

2. Filter calls from the past week

Use a WHERE clause to select only calls where the timestamp is within the past week, e.g., timestamp >= NOW() - INTERVAL '7 days'.

3. Count distinct recipients per caller

Group by caller_id and count distinct recipient_id to get the number of unique people each user called.

4. Filter callers with 3 or more distinct recipients

Apply a HAVING clause to keep only groups where the distinct count is >= 3.

5. Count the number of such users

Wrap the previous query in a subquery or use COUNT(*) OVER () to get the total number of users meeting the condition.

Key Points to Mention

  • Use of DISTINCT to count unique recipients per caller.
  • Proper time filtering with interval arithmetic (e.g., NOW() - INTERVAL '7 days').
  • Grouping by caller_id and using HAVING for the threshold condition.
  • Handling potential NULL values in recipient_id or caller_id.
  • Considering performance implications and indexing on timestamp and caller_id.
  • Clarifying whether the count should include only calls made or also received.

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