FastPrepProject Estimates
Problems/Project Estimates

Project Estimates

AT&T logoAT&T● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an AT&T new grad online assessment. The picture in the report leaves out the numeric limits. We added them. Our version is about 99% the same as the reported question.

A project has received several bids. Given the distinct integer values in projectCosts and a positive integer target, determine how many distinct value pairs have an absolute difference equal to target.

Two pairs are distinct when they differ in at least one value.

Function

countPairs(projectCosts: int[], target: int) → int

Examples

Example 1

projectCosts = [1,3,5]target = 2return = 2

The valid pairs are [1,3] and [3,5].

Example 2

projectCosts = [1,5,3,4,2]target = 2return = 3

The valid pairs are [1,3], [3,5], and [2,4].

Constraints

  • 2 <= projectCosts.length <= 200000.
  • 1 <= projectCosts[i] <= 2 * 10^9.
  • All values in projectCosts are distinct.
  • 1 <= target <= 10^9.

More AT&T Online Assessment questions

  • Companies with Average Salary Above 40000OA · Seen Oct 2026
  • Count Proper Prefix MatchesOA · Seen Oct 2026
  • Minimum Binary Swaps to a PalindromeOA · Seen Oct 2026
  • 3SumOA · Seen Oct 2025
  • Break a PalindromeOA · Seen Oct 2025
  • Advertising System Failures ReportOA · Seen Nov 2024
  • Counting Triplets Divisible by DOA · Seen Nov 2024

Similar questions at other companies

  • Build the Task HierarchyPendo · OA
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Two SumAmazon · OA · PHONE SCREEN
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Customer Signer ScreeningState Farm · OA
  • Minimum Magic Stones After MergesElevenLabs · OAElevenLabs interview questions
  • K Most Recent Unique Request IDsMicrosoft · OAMicrosoft interview questions

Interview reports that mention this question

  • AT&T TDP Software Engineer Questions: 5 Experiences
All AT&T interview questionsSee AT&T hiring insights
Saved
class Solution {
    public int countPairs(int[] projectCosts, int target) {
      // write your code here
    }
}
Checking account…