This is a verified interview question from Salesforce. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Salesforce Pair Sums - Salesforce Online Assessment" covers key patterns like Arrays.
"Salesforce's Case Management System now operates at a massive scale, processing up to a million cases per batch. To assign work efficiently, the operations team must quickly find distinct pairs of cases whose combined resolution times (in minutes) are a non-zero multiple of 60. Pairs are considered distinct by their indices. If two cases share the same resolution time, choosing a different index yields a new pair. Example n = 3 resolutionTimes = [30, 30, 60] Only one valid pair, indices (0, 1), sums to 60. Return 1. Function Description Complete the function multipleSums in the editor below. * multipleSums(int resolutionTimes[n]) — list of integers representing case-resolution times Returns * long: the number of valid pairs whose sum is a non-zero multiple of 60 Constraints * 1 <= n <= 10^6 * 1 <= resolutionTimes[i] <= 10^9 * The answer can be as large as n * (n - 1) / 2; store and return it in 64-bit (long) precision. * Your algorithm must run in O(n) time and use at most O(60) additional space. Note: * The sum must be a non-zero multiple of 60; ignore pairs that sum to 0. * An efficient strategy counts how many times each remainder r = t mod 60 occurs, then uses combinatorics to total all valid pairings. --- Sample Case 0 Sample Input For Custom Testing 4 4 20 60 120 (Which translates to n = 4 and resolutionTimes = [20, 40, 60, 120]) Sample Output 2 Explanation Valid index pairs: (0, 1) and (2, 3)."
Join thousands of developers practicing for Salesforce.