← All problemsSign in

2310. Sum of Numbers With Units Digit K

LeetCodeMathDynamic ProgrammingGreedyEnumerationOpen on judge ↗

Given two integers num and k, consider a set of positive integers with the following properties: - The units digit of each integer is k. - The sum of the integers is num. Return the minimum possible size of such a set, or -1 if no such set exists. Note: - The set can contain multiple instances of the same integer, and the sum of an empty set is considered 0. - The units digit of a number is

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