Share of a Post's First-Week Engagement Reached by Each Hour

Last updated: November 29, 2026

Quick Overview

For Facebook posts created last month, compute what share of each post's first-week engagement arrived within 1, 6, 24 and 72 hours of posting, and report the median share at each checkpoint by post type.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


For Facebook posts created last month, compute what share of each post's first-week engagement arrived within 1, 6, 24 and 72 hours of posting, and report the median share at each checkpoint by post type.

Comes up for Feed ranking data scientists studying content decay, which informs how long a post should stay eligible for ranking. The interviewer checks hours-since-creation math, conditional sums at several checkpoints, and per-post normalization before summarizing.

What the Interviewer Expects
  • Compute hours since creation for each engagement hour
  • Limit to the first 168 hours and to posts with a full week
  • Normalize per post before summarizing
  • Evaluate several checkpoints with UNNEST or conditional sums
  • Summarize with medians by post type
Key Topics to Cover
engagement decay
checkpoints
per-entity normalization
UNNEST
percentiles
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • Why use the per-post median instead of pooled engagement?
  • How would you estimate a half-life of engagement per post type?
  • How does a ranking change show up in this curve?
  • Why might Reels shared into Feed have a longer tail?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

post_engagement_hourly(post_id, hour_ts, engagements) and posts(post_id, created_at, post_type). Hours since creation h = DATE_DIFF('hour', created_at, hour_ts); the hour bucket containing creat...

Approach

Compute h per row, keep h in [0, 168). Per post, sum the total and, for each checkpoint, the sum with h below it. Unnesting an array of checkpoints keeps the query short. Then take the median share pe...


Submit Your Answer
Markdown supported