An opportunity code is a positive integer represented as a string.
You are given:
allowed_digits[]: a sorted array containing the digits that may be used.n: a positive integer.Construct the smallest positive multiple of n such that:
allowed_digits.If no such number exists, return "-1".
string findSmallestOpportunityCode(vector<int> allowed_digits, int n);
allowed_digits: Allowed digits.n: Required divisor.Return the smallest valid opportunity code or "-1" if it is impossible.
1 ≤ n ≤ 10^5 1 ≤ k ≤ 10 0 ≤ allowed_digits[i] ≤ 9 allowed_digits is sorted in increasing order.
Expert in Data Structures & Algorithms. Building tools to help developers crack FAANG interviews.
Qualcomm • Pending
Salesforce • Pending
Salesforce • Pending
Atlassian • Pending
Salesforce • Pending