Screen-to-Screen Transition Probabilities Within Instagram Sessions
Last updated: November 29, 2026
Quick Overview
Given sessionized screen views in Instagram, build a first-order transition table: for each screen, the probability of each next screen within the same session, including the probability that the session ends there.
Meta
November 29, 20260
0
0 solved
Given sessionized screen views in Instagram, build a first-order transition table: for each screen, the probability of each next screen within the same session, including the probability that the session ends there.
A path-analysis task in the style of Meta's data science take-homes and onsite Python rounds, used to understand how people move between Feed, Reels, Stories and Profile. The interviewer checks grouping and ordering per session, a sensible treatment of repeats and exits, and probabilities that sum to one.
What the Interviewer Expects
- Orders screens within each session before pairing
- Adds an explicit exit state after the last screen
- Collapses consecutive repeats of the same screen
- Normalizes counts into probabilities per source screen
- Discusses what a first-order model can and cannot show
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you find the most common three-screen paths instead?
- How would you compare transition tables between two app versions?
- Why collapse repeats, and when would you keep them?
- How would you turn this into a Sankey chart for a product review?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Input rows are (session_id, ts, screen) and are already sessionized. A user scrolling Reels logs many consecutive reels views; I collapse consecutive repeats so the table describes moves between s...
Approach
Group by session, sort by timestamp, build the collapsed path plus EXIT, and count each adjacent pair. Then divide each source screen's counts by its total. An optional top keeps the largest trans...