Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Digit Puzzle With Equation

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Digit Puzzle With Equation. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

ION Markets receives compact numeric codes that follow a repeated-digit multiplication rule. Given a single-digit multiplier, find every three-digit number xyz such that multiplying it by the multiplier produces zzz, where x, y, and z are decimal digits and z is nonzero.

For the extracted case, the multiplier is 3, so the task is to solve xyz * 3 = zzz and identify the number and each digit.

Formal Specification

Implement find_xyz_numbers(multiplier). Return a list of all three-digit integers 100x + 10y + z satisfying:

  • 1 <= x <= 9
  • 0 <= y <= 9
  • 1 <= z <= 9
  • (100x + 10y + z) * multiplier = 111z

Return results in ascending numeric order. The multiplier is an integer from 2 through 9.

Constraints

  • 2 <= multiplier <= 9
  • x is a digit from 1 through 9
  • y is a digit from 0 through 9
  • z is a digit from 1 through 9
  • The output must contain every valid three-digit number

Function Signature

def find_xyz_numbers(multiplier):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output