This is a verified interview question from Amazon. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Process Transactions" covers key patterns like Arrays.
"The team at Amazon ElasticCache is developing on a new solution for frequent updates and computations of existing entries. There are size entry points where the i^{th} entry point is denoted by entries[i]. There are count different updates to be made to the entries where the i^{th} update is denoted by transaction[i][0] and transaction[i][1]. Each transaction consists of two integers denoted by transaction[i][0] and transaction[i][1]. For each i^{th} transaction, perform the following: - For all indices idx, where entries[idx] = transaction[i][0], s < count, 0 ≤ idx < size - Find the sum of all the integers in the array entries. - Persist the updates in the array. Given an integer array entries and a 2D integer array transaction, find the sum of all the entry points after processing each transaction."
Join thousands of developers practicing for Amazon.