Get Success Value (Fungible :)

Problem Overview

  • Compute the success value for each query: sum of the top k view counts in num_viewers.
  • Inputs: num_viewers of size n and queries of size q with k values; Output: an array of q success values.
  • Context: Amazon Prime Video collected viewers across regions; success equals the sum from the k highest-view regions.
  • This Amazon interviews coding interview problem is a common interview question with constraints n,q ≤ 1e5 and values up to 1e9.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: