FastPrepSmallest and Largest Numbers with a Digit Product
Problems/Smallest and Largest Numbers with a Digit Product

Smallest and Largest Numbers with a Digit Product

Jane Street logoJane Street● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in two Jane Street trading desk operations reports from the U.S., both about phone interviews, posted in early 2022. One asked for the largest and the smallest number with no digit 1 whose digits multiply to 96. The other asked only for the largest number whose digits multiply to 96 and did not state any other conditions.

Our function takes the digit product and returns the smallest and the largest such numbers with no digit 1, as strings. Other products, returning an empty array when no number works, the limits and the second and third examples are ours.

Our version is about 85% the same as the reported question.

Consider positive whole numbers that do not contain the digit 1 (or 0) and whose digits multiply to product.

Return an array [smallest, largest] with the smallest and the largest such numbers, written as strings because they can be long. If no such number exists, return an empty array.

Function

extremeNumbers(product: int) → String[]

Examples

Example 1

product = 96return = ["268","322222"]

96 = 2 * 2 * 2 * 2 * 2 * 3. The most digits you can get is six, using only the prime digits, and arranging them from largest to smallest gives 322222. The fewest digits is three: 96 = 8 * 6 * 2, and no two digits multiply to 96. In increasing order that is 268.

Example 2

product = 11return = []

11 is a prime larger than 9, so no digit product can equal it. The answer is an empty array.

Example 3

product = 36return = ["49","3322"]

The fewest digits is two, from 36 = 4 * 9 or 6 * 6; the smaller arrangement is 49. The most digits is four, 3 * 3 * 2 * 2, giving 3322.

Constraints

  • 2 <= product <= 109

More Jane Street Phone Screen questions

  • Maximum-Scoring Consecutive Tree LevelsPHONE SCREEN · Seen Nov 2026
  • Tree Selection and VisibilityPHONE SCREEN · Seen Nov 2026
  • Load/Store Arithmetic InterpreterPHONE SCREEN · Seen Oct 2026
  • Instrument Stack Language JumpsPHONE SCREEN · Seen Oct 2026
  • Run a Stack Language InterpreterPHONE SCREEN · Seen Oct 2026
  • Positive-Integer Expression EvaluationPHONE SCREEN · Seen Oct 2026
  • Add Two Integers Given as StringsPHONE SCREEN · Seen Sep 2026
  • Angle Between Clock HandsPHONE SCREEN · Seen Jul 2026
  • Route Length From Two CyclistsPHONE SCREEN · Seen Jul 2026
  • Sort TradesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026

Similar questions at other companies

  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREENWaymo interview questions
  • IP Range to CIDR BlocksAirbnb · PHONE SCREENAirbnb interview questions
  • Return Exact Cash Register ChangeBank of America · OA
  • Smallest Number With a Given Digit SumAmazon · ONSITE INTERVIEW
  • Minimum Digit Swaps for the Smallest DifferenceLSEG · OALSEG interview questions
  • Maximum Binary Circuit Segregation CostAdobe · OAAdobe interview questions
  • Binary CircuitAkuna Capital · OAAkuna Capital interview questions
  • Minimize Expression with ParenthesesPinterest · OAPinterest interview questions
  • Digit Changes for a Multiple of 9Nutanix · OANutanix interview questions
  • Minimize Difference Between Two NumbersMicrosoft · OAMicrosoft interview questions

Interview reports that mention this question

  • Jane Street TDO Phone Math Round: 26 Experiences (Part 9 of 10)
  • Jane Street TDO Earlier US Finals: 19 Experiences (Part 7 of 10)

Jane Street interview experiences

  • Jane Street TDO UK and Hong Kong: 22 Experiences (Part 10 of 10)
  • Jane Street TDOE US Final Round: 11 Experiences (Part 5 of 10)
  • Jane Street TDOE UK Phone Screen: 15 Experiences (Part 4 of 10)
  • Jane Street TDO Excel and VBA Test: 23 Experiences (Part 8 of 10)
All Jane Street interview questionsSee Jane Street hiring insights
Saved
class Solution {
    public String[] extremeNumbers(int product) {
      // Write your code here.
    }
}
Checking account…