This is a verified interview question from Salesforce. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Salesforce Opportunity Code - Salesforce Online Assessment TIET" covers key patterns like Graphs.
"# Salesforce Opportunity Code 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: - Every digit belongs to `allowed_digits`. - No two consecutive digits are equal. - The number has no leading zeros. If no such number exists, return `"-1"`. ## Function Signature ```cpp string findSmallestOpportunityCode(vector<int> allowed_digits, int n); ``` ### Parameters - `allowed_digits`: Allowed digits. - `n`: Required divisor. ### Returns Return the smallest valid opportunity code or `"-1"` if it is impossible."
Join thousands of developers practicing for Salesforce.