FastPrepAshley Loves Numbers (Financial Engineer)
Problems/Ashley Loves Numbers (Financial Engineer)

Ashley Loves Numbers (Financial Engineer)

Bloomberg LP logoBloomberg LP● MediumINTERNOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Ashley loves Numbers—but only the ones without repeating digits. For example, she loves 12 but hates 11. Given two integers, n and m, Ashley wants to find the count, c, of numbers she will love that are in the inclusive range between n and m.

Complete the countNumbers function in your editor. It has 1 parameter: a 2D array of integers, arr, containing q rows of n and m values. For each row i in arr (where 0 ≤ i < q), the function must print the count (ci) of integers having no repeated digits in the inclusive range between ni and mi.

Input Format

The locked stub code in your editor reads the following input from stdin and passes it to your function: The first line contains an integer, q, denoting the number of rows in arr. The second line contains an integer, 2, denoting the number of columns in arr. Each line i of the q subsequent lines (where 0 ≤ i < q) contains 2 space-separated integers describing the respective values of ni and mi, for row i in arr.

Output Format

For each row i in arr, your function must print the count, ci, of numbers Ashley loves in the inclusive range between ni and mi, on a new line. (I turned the output type into int[] for convience :)

Function

countNumbers(arr: int[][]) → int[]

Examples

Example 1

arr = [[1, 20], [9, 19]]return = [19, 10]

For the first query, Ashley loves all numbers from 1 to 20 except for 11, so the count is 19. For the second query, Ashley loves all numbers from 9 to 19 except for 11, so the count is 10.

Constraints

  • 1 ≤ q ≤ 105 1 ≤ n ≤ m ≤ 106

More Bloomberg LP interview questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Frog Paths Without Long RunsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Get Triplet CountIBM · OAIBM interview questions
  • Count Numbers with the Same Set-Bit CountMicrosoft · OAMicrosoft interview questions
  • Count Reverse-Digit PairsVisa · OAVisa interview questions
  • Get Triplet CountPoint72 · OAPoint72 interview questions
  • Count Shipment SchedulesMorgan Stanley · OAMorgan Stanley interview questions
  • Color a Grid with No Monochromatic Row or ColumnIntuit · OAIntuit interview questions
  • Product of Subset MaximaArcesium · OAArcesium interview questions
  • Find Maximum Number of Balanced CombinationsAmazon · OA
  • Exactly K Preferred Role AssignmentsIMC Trading · OAIMC Trading interview questions

Bloomberg LP interview experiences

  • Bloomberg SWE Phone Screen and Onsite: 1 Experience
  • Bloomberg SWE Phone Screens with Two Teams: 1 Experience
  • Bloomberg AI Interview, Hiring Level Not Reported: 2 Experiences
  • Bloomberg Experienced SWE AI Coding Interviews: 2 Experiences
  • Bloomberg New Grad AI-Assisted Coding Rounds: 3 Experiences
  • Bloomberg New Grad SWE AI-Assisted Coding Rounds: 1 Experience
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int[] countNumbers(int[][] arr) {
      // write your code here
    }

}
Checking account…