HARDasked at 1 company

Human Traffic of Stadium

A hard-tier problem at 50% community acceptance, tagged with Database. Reported in interviews at TikTok and 0 others.

Founder's read

You're looking at a database problem that hits like a curveball in a SQL round. Human Traffic of Stadium is asked at TikTok and sits at 50% acceptance on hard tier, which means half the candidates who attempt it leave empty-handed. The trap is that this looks like a simple aggregation query until you realize you need to detect consecutive days of traffic patterns. If you haven't drilled window functions and lag/lead logic lately, this one will stall you fast. StealthCoder's the hedge: if you blank on the consecutive-day framing during your live assessment, it surfaces a working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
HARD
Acceptance
50%

Companies that ask "Human Traffic of Stadium"

If this hits your live OA

Human Traffic of Stadium is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The problem asks you to find stadium traffic records where the traffic on that day meets a threshold, AND the traffic threshold is met on the days immediately before and after it. That consecutive-day requirement is what separates a one-liner from a real solution. Most candidates default to WHERE clauses and simple GROUP BY logic, which fails because you can't compare rows across the result set without window functions. You need LAG and LEAD (or ROW_NUMBER with self-joins) to pull previous and next day values into the same row, then filter on all three conditions at once. The second pitfall is date ordering: if your records aren't sorted by visit_date, your window function output becomes garbage. SQL window functions are the core of this problem, not just database fundamentals. Candidates who haven't practiced lag/lead on harder problems will run out of time trying to join the table to itself three times.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Human Traffic of Stadium recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Human Traffic of Stadium interview FAQ

Is this problem still asked at TikTok or just historical data?+

The input data confirms TikTok has asked it. Job market priority shifts fast, but problems don't disappear overnight. If you're interviewing at TikTok or any FAANG with analytics teams, window function SQL problems like this one stay in rotation because they test real engineering capability.

Why is the acceptance rate only 50% if it's labeled hard?+

Most candidates treat it as a simple aggregation and miss the consecutive-day requirement. Once you see the pattern, the solution is cleaner than alternatives. The 50% split reflects candidates who think to use window functions versus those who don't, not total difficulty.

What's the core trick I need to know before the OA?+

LAG and LEAD let you pull the previous and next row's values into your current row. Write your WHERE clause to filter for traffic on day N, N-1, and N+1 all at once. That's the entire insight. Everything else is syntax.

Can I solve this without window functions?+

Technically yes, with self-joins, but it's slower and harder to read. Three self-joins on the same table for previous, current, and next day will execute, but window functions are the modern, cleaner approach. Interviewers expect you to know them.

How does this relate to other database problems I should know?+

It's a window function problem, not a pure aggregation problem. If you've only drilled GROUP BY and HAVING, you'll struggle. Practice LAG/LEAD and ROW_NUMBER patterns across multiple problems before this one hits you live.

Want the actual problem statement? View "Human Traffic of Stadium" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.