You are building a simple ads platform that assigns ads to browser positions for a specific user.
You are given the following inputs:
-
browserPositions: a list of browser position names. Positions must be considered in the given order. -
candidateAds: a list of ads that may be shown during this call. -
userAdState: a map fromadIdto the number of times the user has already seen that ad.- An
adIdmissing fromuserAdStatehas a display count of0. - Entries in
userAdStatefor ads not included incandidateAdsdo not affect the result.
- An
You are also given a custom data structure Ad:
class Ad {
String adId;
int maxDisplay;
}
adIdis the unique identifier of the ad.maxDisplayis the maximum number of times the ad may be shown to this user.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Stdout
-