Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2310. Sum of Numbers With Units Digit K
Find the minimum number of positive integers (repetition allowed) whose units digit is k that sum to num, or return -1 if impossible. The problem reduces to a modular-arithmetic check: you need the smallest m (possibly 0 when num==0) such that (m*k) % 10 == num % 10 and m*k <= num, otherwise it's impossible.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.