FastPrepCount Pairs Differing in One Digit
Problems/Count Pairs Differing in One Digit

Count Pairs Differing in One Digit

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two ZipRecruiter new-grad OA reports describe counting index pairs, equal decimal length, and exactly one digit that differs in the same position. The numbers are positive, which removes any question about signs and leading zeros. We supplied limits and a function signature.

Given positive integers numbers, count index pairs i < j whose ordinary decimal representations have equal length and differ at exactly one aligned digit position.

Function

countOneDigitDifferencePairs(numbers: int[]) → long

Examples

Example 1

numbers = [12,13,22,12]return = 4

The qualifying index pairs are the first 12 with 13 and 22, 13 with the final 12, and 22 with the final 12.

Example 2

numbers = [1,2,3]return = 3

Every pair differs at its only digit.

Constraints

  • 0 <= numbers.length <= 2000
  • 1 <= numbers[i] <= 1000000000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
  • Customer Signer ScreeningState Farm · OA
  • REST API: Highest International StudentsRippling · OARippling interview questions
  • String-Pair Frequency SimilarityIBM · OAIBM interview questions
  • Find Sliding-Window Pattern Start IndicesVisa · OAVisa interview questions
  • Closest ColorTwo Sigma · OATwo Sigma interview questions
  • Number-Character Bijective MappingAdobe · OAAdobe interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public long countOneDigitDifferencePairs(int[] numbers) {
        // Write your code here.
    }

}
Checking account…