Implement an AdService with InsertAd and GetAd APIs.
Unlock detailed company stats for this questionUpgrade
Implement an AdService with two APIs: InsertAd(content string, score int) and GetAd(), which returns an ad. The returned ad must follow three conditions:
- The ad with the highest score is returned.
- No ad is used consecutively.
- When an ad is retrieved, its score reduces by 1.
Community answers
No answers contributed by the community yet.
Related questions
Implement an LRU Cache with O(1) get and put.Implement insert, delete and getRandom in O(1).Design and implement an LRU Cache with O(1) get and put.Related courses

Course

Course
Course
