In a Salesforce-based firm, a Sales Operations Manager needs to ensure that the total revenue from two different sales campaigns is balanced.
The campaigns are represented by two arrays, campaignA and campaignB, where each element represents the revenue generated by a specific sales unit.
Some units have not yet generated any revenue, represented by 0.
The goal is to assign a strictly positive revenue amount to every zero-valued unit such that the total revenue of both campaigns becomes equal.
Determine the minimum possible total revenue that can be achieved in both campaigns. If it is impossible to make the total revenues equal, return -1.
Parameters
int campaignA[n]: revenue units from the first campaign int campaignB[m]: revenue units from the second campaign
Returns
The minimum equal revenue possible -1 if equal allocation is impossible
Constrains: 1 ≤ n, m ≤ 10^5 0 ≤ campaignA[i], campaignB[i] ≤ 10^4
Expert in Data Structures & Algorithms. Building tools to help developers crack FAANG interviews.
Expedia • Pending
Expedia • Pending
Salesforce • Pending
Future First • Pending
ARM • Pending