#25

Streaming Average Score per Landing Page

EASYHash Table, StreamingPYTHON

Problem Description

An ads analytics pipeline processes a stream of post-click quality rating events and computes the running average quality score per landing page. Each event contains a user ID, landing page name, advertiser vertical, and a quality score. Process events one at a time (streaming) and compute the average quality score per landing page across all events seen so far. **Input:** `events` — a list of `(user_id, page_name, vertical, score)` tuples in arrival order. **Output:** A dict mapping each landing page name to its average quality score (float) across all events.

Topics

hash tablestreaming

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 →