Engineering Coordinator Interview Questions

33,953 engineering coordinator interview questions shared by candidates

There is a string text consisting of at most 10 letters. Replace all occurrences of each distinct letter in text with a different decimal digit (each occurrence of the same letter should be replaced with the same digit). The choice of digit for each letter does not matter as long as the digit is different from the digits chosen for other letters. After the replacements, the text treated as a number should be as large as possible. Write a function: string solution(string &text); that, given a string text, returns a string representing the largest number that can be obtained. Examples: Given text = "BABBC" Since letter 'A' can be replaced with digit 8, each letter 'B' with 9 and letter 'C' with 7. The function should return "98997". Note that there are another valid substitutions, for example "12113", but "98997" represents the largest number among them. Given text = "XYYZZZ", the function should return "988777". Assume that: the length of string text is within the range [1..10]; string text consists only of uppercase letters (A−Z).
avatar

Software Engineering Intern

Interviewed at Google

4.4
Jan 27, 2024

There is a string text consisting of at most 10 letters. Replace all occurrences of each distinct letter in text with a different decimal digit (each occurrence of the same letter should be replaced with the same digit). The choice of digit for each letter does not matter as long as the digit is different from the digits chosen for other letters. After the replacements, the text treated as a number should be as large as possible. Write a function: string solution(string &text); that, given a string text, returns a string representing the largest number that can be obtained. Examples: Given text = "BABBC" Since letter 'A' can be replaced with digit 8, each letter 'B' with 9 and letter 'C' with 7. The function should return "98997". Note that there are another valid substitutions, for example "12113", but "98997" represents the largest number among them. Given text = "XYYZZZ", the function should return "988777". Assume that: the length of string text is within the range [1..10]; string text consists only of uppercase letters (A−Z).

Viewing 1761 - 1770 interview questions

See Interview Questions for Similar Jobs

Glassdoor has 33,953 interview questions and reports from Engineering coordinator interviews. Prepare for your interview. Get hired. Love your job.