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

Count Pairs Differing in One Digit

Roblox logoRoblox● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Roblox online assessment. The report asks for counting pairs of integers that differ in exactly one digit. We chose that numbers are compared as decimals of equal length, that values are positive, how to treat repeated indices, and the limits. Our version is about 85% the same as the reported question.

You are given an array of positive integers numbers. Count pairs of indices i < j where the two numbers have the same number of decimal digits and differ at exactly one digit position.

For this exercise, assume decimal representations have no leading zeros. Different occurrences of an equal value are different array elements, but two equal values differ at zero positions and therefore do not form a qualifying pair.

Return the number of qualifying index pairs as a signed 64-bit integer.

Function

countOneDigitDifferencePairs(numbers: int[]) → long

Examples

Example 1

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

The qualifying pairs connect either occurrence of 12 with 13 or 22. The equal values do not qualify.

Example 2

numbers = [1,2,10,20]return = 2

The pairs are 1 with 2 and 10 with 20. Different decimal lengths are not compared.

Example 3

numbers = [111,121,131,222]return = 3

The first three values differ only at their middle digit, producing three pairs. 222 differs at more than one position from each.

Constraints

  • 0 <= numbers.length <= 100000.
  • 1 <= numbers[i] <= 10^9.

More Roblox Online Assessment questions

  • Centered Block Placement QueriesOA · Seen Oct 2026
  • Robot Navigation Around LasersOA · Seen Oct 2026
  • Factory Batch Profit (Game Adaptation)OA · Seen Sep 2026
  • Nested Recipe Blocks (Game Adaptation)OA · Seen Sep 2026
  • Vehicle Builds for Required Terrain (Game Adaptation)OA · Seen Sep 2026
  • Track Received Byte RangesOA · Seen Sep 2026
  • Inventory Discount TrackerOA · Seen Sep 2026
  • Break a PalindromeOA · Seen Jun 2026
  • Find Zero Cells in a 2×2 GridOA · Seen Oct 2025
  • Cat Route Budget Planning (Game Adaptation)OA · Seen Aug 2025

Similar questions at other companies

  • Count Suffix Word PairsTikTok · OA
  • Count One-Swap Number PairsCapital One · OA
  • Maximum Equal Parts for PrefixesAmazon · OA
  • Cheating CodemakerJane Street · OA
  • Candidate Alias Name MatchingCheckr · OA · PHONE SCREEN
  • Aggregate Paginated Project Run RecordsReplit · OA
  • Maximum Common Decimal Prefix Across ArraysZipRecruiter · OA
  • Count User Mentions in Chat MessagesRamp · OA
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Word Frequency Counts in Alphabetical OrderAbridge · OA

Interview reports that mention this question

  • Roblox OA: What It Tests (2026)
  • Roblox New Grad Coding Rounds: 23 Experiences (Part 2 of 7)

Roblox interview experiences

  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)
  • Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
See Roblox hiring insights
Saved
class Solution {
    public long countOneDigitDifferencePairs(int[] numbers) {
        // write your code here
    }

}
Checking account…