Tap here to switch tabs
Problem
Submissions

Problem: Smallest All-Ones Multiple

Smallest All-Ones Multiple gives you a positive integer k and asks for the length of the shortest number made only of digit 1 that is divisible by k, or -1 if none exists.

Statement

Given a positive integer k, find the length of the smallest positive integer n such that n is divisible by k, and n contains only the digit 11 in its decimal representation.

Return the length of n. If no such integer n exists, return −1-1.

Constraints:

  • 2≤2 \leq k ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest All-Ones Multiple

Smallest All-Ones Multiple gives you a positive integer k and asks for the length of the shortest number made only of digit 1 that is divisible by k, or -1 if none exists.

Statement

Given a positive integer k, find the length of the smallest positive integer n such that n is divisible by k, and n contains only the digit 11 in its decimal representation.

Return the length of n. If no such integer n exists, return −1-1.

Constraints:

  • 2≤2 \leq k ≤105\leq 10^5