Back to problems

Top-K Ads from Log + Sliding-Window Ingest

Algorithm · Pinterest · Medium

Examples Example 1 Example 2 Requirements Part 1 — batch_top_k(records, k): receive a collection of impression entries, where every entry includes an advertiser identifier and a time value, and produce the K advertisers with the largest overall impression totals. The ordering rule for equal totals is not prescribed; choose either arrival order or alphabetical identifier order, and state which rule you use. Part 2 — ingestImpressions(impression): adapt Part 1 into an…

Checking your access…