#168
WhatsApp L7 Active Message Types
MEDIUMHash Table, Array, Data AnalysisPYTHON
Problem Description
A messaging analytics pipeline computes L7 (Last 7 Days) activity rollups — grouping low-level message types into higher-level categories and counting how many days each category had at least one active type.
**Inputs:**
- `activity_map`: Dictionary where each key is a message type and each value is a list of 7 binary values (1=active, 0=inactive) representing daily activity
- `rollups`: Dictionary defining higher-level groupings of message types (rollup name → list of message type keys)
**Output:**
A dictionary mapping each rollup name to the count of days (out of 7) where at least one message type in that rollup had activity.
**Key Rules:**
- A day is active for a rollup if ANY of its constituent message types has value 1 on that day
- Return one count per rollup — the number of such active days
Topics
aggregationarraydata analysishash table
Asked at Companies
meta
Solve This Problem
Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.
Start Solving →