In this video, we solve Leetcode 1015. Smallest Integer Divisible by K using Java.
Question Link - https://leetcode.com/problems/smallest-integer-divisible-by-k/description/?envType=daily-question&envId=2025-11-25
Solution: https://github.com/deepak-sharma-iOS/Leetcode-Daily-Challenge/blob/main/Leetcode-1015.java
Summary:
This solution finds the smallest number made of only 1’s (like 1, 11, 111…) that is divisible by `k`.
It builds the remainder iteratively using `(rem * 10 + 1) % k`, avoiding large number overflow.
If the remainder becomes zero at length `l`, that means a repunit of length `l` is divisible by `k`.
Numbers divisible by 2 or 5 can never be formed by only 1’s, so those return `-1` immediately.
Subscribe - https://www.youtube.com/@DebugWithDeepak
Github - https://github.com/deepak-sharma-iOS/Leetcode-Daily-Challenge
Linkedin - https://www.linkedin.com/in/deepak-sharmaa-dev/
#CodeWithDeepak #LeetCodeDailyChallenge #LeetCodeSolutions #DSAforInterviews #CodingWithExplanation #TechInterviewPrep #CrackTheCodingInterview #DailyCodingChallenge #JavaCoding #LearnToCode #CodingShorts #leetcodedailychallenge #euclidean
Download
0 formats
No download links available.
Smallest Integer Divisible by K | Leetcode 1015 | DSA | HIndi Explaination | Code With Deepak | NatokHD