Design an Ad Service That Rotates by Score
Asked at Google · Coding Questions · Difficulty: Medium · Last asked Nov 7, 2026
An advertising service stores ads, each with a text and a score, and hands out one ad per request. Higher-scoring ads should be shown more often, but the same ad must not appear twice in a row, and an ad that has just been shown loses a little of its score so that others get their turn. Build this service.
Loading the problem…