Intern Software Interview Questions

17,763 intern software 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).

You are given two sets of integers, sizes M and N with M < N. Perform inner equal join on these two sets (i.e., find intersection of the two lists). How to perform it if both the lists are in files and the available memory is of size K < M < N.
avatar

Software Engineering Intern

Interviewed at Google

4.4
May 10, 2010

You are given two sets of integers, sizes M and N with M < N. Perform inner equal join on these two sets (i.e., find intersection of the two lists). How to perform it if both the lists are in files and the available memory is of size K < M < N.

Viewing 1141 - 1150 interview questions

Glassdoor has 17,763 interview questions and reports from Intern software interviews. Prepare for your interview. Get hired. Love your job.