Tap here to switch tabs
Problem
Submissions

Problem: Sum of Numbers With Units Digit K

med
30 min
Try to solve the Sum of Numbers With Units Digit K problem.

Statement

You are given two integers, num and k.

Determine the minimum possible size of a collection of positive integers where each integer has a units digit equal to k, and the sum of all integers in the collection equals num.

Return the minimum size of such a collection, or −1-1 if no valid collection exists.

Note: The sum of an empty collection is considered 00. The collection may contain multiple instances of the same integer.

Constraints:

  • 0≤0 \leq num ≤3000\leq 3000

  • 0≤0 \leq k ≤9\leq 9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Numbers With Units Digit K

med
30 min
Try to solve the Sum of Numbers With Units Digit K problem.

Statement

You are given two integers, num and k.

Determine the minimum possible size of a collection of positive integers where each integer has a units digit equal to k, and the sum of all integers in the collection equals num.

Return the minimum size of such a collection, or −1-1 if no valid collection exists.

Note: The sum of an empty collection is considered 00. The collection may contain multiple instances of the same integer.

Constraints:

  • 0≤0 \leq num ≤3000\leq 3000

  • 0≤0 \leq k ≤9\leq 9