Find Network Calls (Also For Amazon UK :)

Problem Overview

  • Given reviews[] and counts[], compute for each target in counts the total number of API calls to set every product’s reviews to that target, where each call adds or removes one review.
  • Input: n products (up to 1e5) and q targets (up to 1e5), values up to 1e6; Output: an array of q totals.
  • Context: E-commerce marketing at Amazon adjusting product review counts via APIs.
  • From Amazon interviews; a coding interview problem often asked as an interview question (also seen at Amazon UK).

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: