rollingtime series

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd
import numpy as np

plays = pd.DataFrame({
    "video_id": [1, 1, 2, 2, 3, 3, 4, 5, 5, 6],
    "creator": ["@chefmina", "@chefmina", "@chefmina", "@chefmina", "@dancelab", "@dancelab", "@dancelab", "@petsdaily", "@petsdaily", "@petsdaily"],
    "duration_sec": [35, 35, 18, 18, 22, 22, 60, 90, 90, 15],
    "watched_sec": [35, 10, 18, 6, 22, 11, 20, 90, 45, 15],
    "liked": [1, 0, 1, 0, 1, 0, 0, 1, 1, 1],
})

gifts = pd.DataFrame({
    "creator": ["@chefmina", "@chefmina", "@dancelab", "@petsdaily", "@petsdaily", "@gymrat"],
    "day": ["2024-03-02", "2024-03-09", "2024-03-05", "2024-03-03", "2024-03-06", "2024-03-04"],
    "coins": [620, 250, 80, 2400, 600, 450],
})
gifts["day"] = pd.to_datetime(gifts["day"])

Guest mode · solve history stays on this device; code isn’t saved. Sign in to save future work

Pro problem

“Rolling 3-day coin total”

This is one of the real interview questions in Pro. Try Pro free for 7 days to unlock it and everything below:

  • 293 interview-grade problems across SQL, Python & pandas
  • 104+ real-world SQL problems: SaaS retention, fintech ledgers, supply chain, recursive CTEs
  • 18 company interview packs (Amazon, Meta, Google, Uber and more)
  • AI "explain my mistake" tutor and mock interviews
  • Use QueryLab inside Claude, Cursor & other AI assistants

// built for real interview rounds

Practice the patterns 18 top companies test

329 problems · 36 free forever · 293 unlocked with Pro

Card required. Then $12/month. Cancel before your trial ends and you pay nothing.

or keep practicing free problems →

Secure checkout by Paddle · instant access · cancel anytime from your account