EASYasked at 1 company

User Activity for the Past 30 Days I

A easy-tier problem at 49% community acceptance, tagged with Database. Reported in interviews at Zoom and 0 others.

Founder's read

Zoom asks this one constantly, and it looks deceptively simple on the surface. You're writing a SQL query to pull user activity over a rolling 30-day window. Most candidates either hardcode a specific date (instant fail on the actual OA) or write a join that works in theory but times out on real data. The acceptance rate hovers just under 50%, which means half the people who attempt it miss the trick. If you blank on how to structure the date logic during your Zoom assessment, StealthCoder surfaces the correct query in seconds, invisible to the proctor.

Companies asking
1
Difficulty
EASY
Acceptance
49%

Companies that ask "User Activity for the Past 30 Days I"

If this hits your live OA

User Activity for the Past 30 Days I 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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround.

Get StealthCoder
What this means

The gotcha here is the date arithmetic. You can't just filter where activity_date >= '2023-01-01' because the problem wants the past 30 days relative to the latest date in the table, not relative to today. Most first attempts either hardcode today's date (fails when the OA runs tomorrow) or use CURRENT_DATE without accounting for what 'today' actually is in the dataset. You need a subquery or CTE to find MAX(activity_date), then subtract 30 days from that point. The secondary trap is grouping and aggregation. Make sure your SELECT list matches your GROUP BY, and watch for NULL handling in counts. When you're live on the assessment and the obvious date filter doesn't work, that's where StealthCoder becomes your safety net.

Pattern tags

The honest play

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

User Activity for the Past 30 Days I recycles across companies for a reason. It's easy-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 because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround. Works on HackerRank, CodeSignal, CoderPad, and Karat.

User Activity for the Past 30 Days I interview FAQ

Do I need to handle timezone conversion for a Zoom interview question?+

The problem statement typically doesn't mention timezones, so assume UTC or the database's default. Zoom's questions usually skip that complexity at the EASY level. Focus on the 30-day logic first. If timezone handling mattered, it would be spelled out in the prompt.

Why does my query return the right rows but times out?+

You're likely joining without an index on the date column, or you're doing a Cartesian product. Verify your WHERE clause is filtering early, not after the join. Use EXPLAIN to check the execution plan. Most timeouts come from missing WHERE conditions that should narrow the table before aggregation.

Is the 30-day window inclusive on both ends?+

Typically yes, but the exact requirement depends on the problem statement. Common interpretations are 'within 30 days' (inclusive) or 'in the past 30 days' (depends on whether you include the boundary date). Read the examples carefully. If ambiguous, both 29 and 30 days should give similar row counts as a sanity check.

Should I use a window function or a GROUP BY for aggregation?+

If you need per-user stats, GROUP BY is simpler and more efficient. Window functions shine if you need to retain all rows with running counts or rank users. The problem usually signals which via the expected output shape. Check whether the result has one row per user or one row per activity record.

How do I know if my answer is right before submitting on the OA?+

Run it against the sample input and manually verify the row count and aggregates match. Check edge cases: does the query handle the boundary date correctly. Do NULL user IDs get filtered. Does the date math work if you run it on different days. Small test runs catch most logic errors before submission.

Want the actual problem statement? View "User Activity for the Past 30 Days I" 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.