← All problemsSign in

3790. Smallest All-Ones Multiple

LeetCodeHash TableMathOpen on judge ↗

You are given a positive integer k. Find the smallest integer n divisible by k that consists of only the digit 1 in its decimal representation (e.g., 1, 11, 111, ...). Return an integer denoting the number of digits in the decimal representation of n. If no such n exists, return -1. Example 1: Input: k = 3 Output: 3 Explanation: n = 111 because 111 is divisible by 3, but 1 and 11 are not.

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start