Company: Intuit_30nov
Difficulty: medium
Smallest Multiple Problem Description Given an integer n and a set of digits allowed_digits of size k , find some number num > 0 that is the smallest multiple of n such that: Each digit of num is present in the set allowed_digits . No two consecutive digits are equal. For example, 123 is allowed but 122 is not. If there is no such num possible, return "-1" (without quotes, but as a string). Example 1: Input: n = 6, allowed_digits = [0, 1, 2, 3] Output: "12" Explanation: We check the multiples of 6: The first multiple of 6 is 6. The digit 6 is not present in allowed_digits . The second multiple of 6 is 12. It is made of digits from allowed_digits (1 and 2). No two of its consecutive digits are equal. It satisfies both conditions. Thus, 12 is the smallest multiple possible. Example 2: Input: n = 10, allowed_digits = [0, 1] Output: "10" Explanation: The first multiple of 10 is 10. This can be made by taking digits from allowed_digits and does not contain two consecutive equal digits. Exam