FastPrepCount Pair Sums in a Range
Problems/Count Pair Sums in a Range

Count Pair Sums in a Range

Adobe logoAdobe● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Adobe online assessment for new grads. The report gives the rule for counting pair sums that include both ends of the range, and an example. In our version, the limits allow negative values and large pair counts. Our version is about 98% the same as the reported question.

Count pairs of indices i < j for which low <= arr[i] + arr[j] <= high. Both endpoints are inclusive. Equal values at different indices count as different choices.

Function

countRangePairs(arr: int[], low: int, high: int) → long

Examples

Example 1

arr = [2,3,4,5]low = 5high = 7return = 4

The valid value pairs are (2,3), (2,4), (2,5), and (3,4), giving four index pairs.

Example 2

arr = [1,1,1]low = 2high = 2return = 3

All three choices of two distinct indices have sum 2.

Constraints

  • For this exercise, assume 1 <= arr.length <= 100000.
  • For this exercise, assume -10^9 <= arr[i] <= 10^9.
  • For this exercise, assume -2 * 10^9 <= low <= high <= 2 * 10^9.

Source note: Original OA task images and any included source example. The practice contract follows the rules stated in the problem and source note.

More Adobe Online Assessment questions

  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Top-Funded Villages and ProjectsOA · Seen Aug 2026
  • Count Parent Nodes With a Target SumOA · Seen Aug 2026
  • Largest Binary Number by ConcatenationOA · Seen Aug 2026
  • Count Events by CategoryOA · Seen Aug 2026
  • Graph M-ColoringOA · Seen Aug 2026
  • Hall of Shifting TilesOA · Seen Aug 2026
  • K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
  • Maze ReachabilityOA · Seen Aug 2026
  • Minimum Numeric Code TransformationOA · Seen Aug 2026

Similar questions at other companies

  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
  • Minimum Removals to Balance ArraySalesforce · OASalesforce interview questions
  • Count Perfect PairsAdyen · OAAdyen interview questions
  • Profitable Project PairsAkuna Capital · OAAkuna Capital interview questions
  • 3SumAT&T · OAAT&T interview questions
  • Minimum Height Difference Between Distant PeaksRoblox · OARoblox interview questions
  • Minimum Machines for TasksExpedia · OAExpedia interview questions
  • Find Minimum Possible SizeMathWorks · OAMathWorks interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
  • Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public long countRangePairs(int[] arr, int low, int high) {
        // Write your solution here.
    }

}
Checking account…