Challenge: Maximum Advertisement Revenue

Solve the Maximum Product of the Two Sequences Problem.

We'll cover the following

Problem


This problem is similar to the Maximum Product of Two Sequences Problem.

Maximum Product of Two Sequences

Find the maximum dot product of two sequences of numbers.

Input: Two sequences of nn positive integers: price1,,pricenprice_{1},\ldots, price_{n} and clicks1,,clicksnclicks_{1},\ldots, clicks_{n}.
Output: The maximum value of price1c1++pricenprice_{1} · c_{1} +\ldots + price_{n} . cnc_{n}, where c1,,cnc_{1},\ldots, c_{n} is a permutation of clicks1,,clicksnclicks_{1},\ldots, clicks_{n}.


Level up your interview prep. Join Educative to access 70+ hands-on prep courses.