Max Book Copies π«
Amazon invests in the success of entrepreneurs, artisans, and small business selling in the Amazon Store. Some of these small business are book stores.
Amazon maintains a protal, where the booksellers can update their inventories. An update received from the
portal is represented by the array portalUpdate, whose valuess indicate the following:
portalUpdate[i] is a positive integer (for example 7), then a copy of the book with boook
ID portalUpdate[i] is added to the inventory.portalUpdate[i] is a negative integer (for example -11), then a copy of the book with
book ID portalUpdate[i] (i.e., book ID 11) is removed from the inventory. It is
gauranteed that each such update will only be requested if the inventory currently has at least
one copy of that book ID.portalUpdate[i] is gauranteed to be non-zero.Given the list of portal updates, the task is to return the maximum copies of any book in the inventory after each update.
Complete the function maximumBookCopies in the editor.
maximumBookCopies has the following parameter:
int portalUpate[n]: the updates to the inventoryReturns
int[n]:
an array of integers representing the maximum copies of any book after each update
1Example 1

2Example 2
Constraints
Limits and guarantees your solution can rely on.
1 <= n <= 106-109 <= portalUpdate[i] <= 109, for 0 <= i < nportalUpdate[i] != 0