You are a social media data analyst tasked with identifying users who exhibit bursty posting behavior during February 2024. This is a common pattern in social networks where users have periods of high activity followed by quieter times.
Bursty behavior is defined as any 7-day period where a user's posting frequency is at least twice their average weekly posting frequency for the entire month.
Given a Posts table with columns:
post_id(int) - Primary keyuser_id(int) - User identifierpost_date(date) - When the post was made
Your task: Find all users who demonstrate bursty behavior and return their user_id, max_7day_posts (maximum posts in any 7-day period), and avg_weekly_posts (average posts per week in February).
Important: Only analyze posts from February 1-28, 2024 (exactly 4 weeks). Order results by user_id ascending.
Input & Output
Visualization
Time & Space Complexity
Where n is number of posts, dominated by sorting for window function
Space for intermediate results and window function calculations
Constraints
- 1 โค post_id โค 106
- 1 โค user_id โค 105
- post_date is in YYYY-MM-DD format
- Only posts from February 1-28, 2024 are considered
- Each post_id is unique
- Result must be ordered by user_id ascending