← Back to challenges

Smallest N Digit Number

JavaScriptHardnumbersmath

Instructions

Write a function that returns the smallest N-digit number which is a multiple of the specified value.

Examples

smallest(3, 8) ➞ 104
// Smallest 3-digit integer that is a multiple of 8

smallest(5, 12) ➞ 10008

smallest(7, 1) ➞ 1000000

smallest(2, 3) ➞ 12

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Find the True Equations