Design number of ads to show to users on a google search

In an interview I was asked to design the system that calculates the number of ads that will be displayed to a user after each query made on google search engine. May I know your solutions/approaches/algorithms to deal with this problem?

Comments (2)