Sum of M maximum distinct digit sum from 1 to N that are factors of K
Given an array of natural numbers upto N and two numbers M and K, the task is to find the sum of M maximum distinct digit sum M numbers from N natural numbers which are factors of K. Examples: Input: N = 50, M = 4, K = 30 Output: 16 Explanation: From 1 to 50, factors of 30 = {1, 2, 3, 5, 6, 10, 15,