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 the rightmost digit of the number.


&nbsp;
Example 1:

Input: num = 58, k = 9
Output: 2
Explanation:
One valid set is [9,49], as the sum is 58 and each integer has a units digit of 9.
Another valid set is [19,39].
It can be shown that 2 is the minimum possible size of a valid set.


Example 2:

Input: num = 37, k = 2
Output: -1
Explanation: It is not possible to obtain a sum of 37 using only integers that have a units digit of 2.


Example 3:

Input: num = 0, k = 7
Output: 0
Explanation: The sum of an empty set is considered 0.


&nbsp;
Constraints:


	0 &lt;= num &lt;= 3000
	0 &lt;= k &lt;= 9


class Solution:
    def minimumNumbers(self, num: int, k: int) -> int:
        if num == 0:
            return 0
        
        if k == 0:
            return 1 if num % 10 == 0 else -1
        
        for n in range(1, min(num // k, 10) + 1):
            if (num - n * k) % 10 == 0:
                return n
        
        return -1
class Solution
{
    public int minimumNumbers(int num, int k)
    {
        if(num == 0)
            return 0;
        if(k == 0)
            if(num % 10 == 0) //E.g. 20,1590,3000
                return 1;
            else
                return -1;
        for(int i = 1; i <= num/k; i++) // Start with set size 1 and look for set having unit's digit equal to that of num
            if(num % 10 == ((i*k)%10)) // Look for equal unit's digit
                return i;

        return -1;
    }
}
class Solution {
public:
   
    //same code as that of coin change
    int coinChange(vector<int>& coins, int amount) {
        int Max = amount + 1;
        vector<int> dp(amount + 1, INT_MAX);
        dp[0] = 0;
        for (int i = 0; i <= amount; i++) {
            for (int j = 0; j < coins.size(); j++) {
                if (coins[j] <= i && dp[i-coins[j]] !=INT_MAX) {
                    dp[i] = min(dp[i], dp[i - coins[j]] + 1);
                }
            }
        }
        return dp[amount] == INT_MAX ? -1 : dp[amount];
    }
 
    
    
    int minimumNumbers(int num, int k) {
    vector<int>res;
    for (int i = 0; i <= num; i++){
        if (i % 10 == k)
           res.push_back(i);
        }
       return coinChange(res, num);

       
    }
    
};
var minimumNumbers = function(num, k) {
    if (num === 0) return 0;
    for (let i = 1; i <= 10; i++) {
        if (k*i % 10 === num % 10 && k*i <= num) return i;
        if (k*i > num) return -1
    } return -1;
};
Sum of Numbers With Units Digit K