Software Engineer Graduate Interview Questions

4,487 software engineer graduate interview questions shared by candidates

HackerRank Challenge Question 1: For a set of numbers (e.g. {1, 2, 2, 2, 3, 4, 1, 5, 1, 6}) the degree of the set is the largest number of occurences of the same element. In the given example the degree is 3 as both element 1 and element 2 occur 3 times each. Given a set of numbers, return the length of the smallest subset that has the same degree as the original set. For the given example, the two subsets with the same degree as the original set are {1, 2, 2, 2, 3, 4, 1, 5, 1} and {2, 2, 2}. The first subset is 9 elements long and the second one is 3 elements long, so the program should return 3. HackerRank Challenge Question 2: Given the length of a path and a set of back and forth runs on this path, return the position on the path that is visited most often at the end of all runs. If there are multiple positions that meet this criterion, return the lowest position. Example: Path length: 9 Path positions: 1 2 3 4 5 6 7 8 9 Set of runs: {2, 7, 3, 9, 1, 5} The set of runs translates to: start at 2, run to 7; start at 7, run to 3; start at 3, run to 9; start at 9, run to 1; start at 1, run to 5. Note that each position is visited once when the run ends there and once when the run starts there, so for example when you run from 2 to 7 and then from 7 to 3, you have visited 7 twice. Given the above example, positions 3, 4 and 5 would all have been visited 5 times, which is the largest number of visits, but the program should return the lowest such positions, which is 3.
avatar

Graduate Software Engineer

Interviewed at Improbable

3.3
Nov 13, 2017

HackerRank Challenge Question 1: For a set of numbers (e.g. {1, 2, 2, 2, 3, 4, 1, 5, 1, 6}) the degree of the set is the largest number of occurences of the same element. In the given example the degree is 3 as both element 1 and element 2 occur 3 times each. Given a set of numbers, return the length of the smallest subset that has the same degree as the original set. For the given example, the two subsets with the same degree as the original set are {1, 2, 2, 2, 3, 4, 1, 5, 1} and {2, 2, 2}. The first subset is 9 elements long and the second one is 3 elements long, so the program should return 3. HackerRank Challenge Question 2: Given the length of a path and a set of back and forth runs on this path, return the position on the path that is visited most often at the end of all runs. If there are multiple positions that meet this criterion, return the lowest position. Example: Path length: 9 Path positions: 1 2 3 4 5 6 7 8 9 Set of runs: {2, 7, 3, 9, 1, 5} The set of runs translates to: start at 2, run to 7; start at 7, run to 3; start at 3, run to 9; start at 9, run to 1; start at 1, run to 5. Note that each position is visited once when the run ends there and once when the run starts there, so for example when you run from 2 to 7 and then from 7 to 3, you have visited 7 twice. Given the above example, positions 3, 4 and 5 would all have been visited 5 times, which is the largest number of visits, but the program should return the lowest such positions, which is 3.

Viewing 541 - 550 interview questions

Glassdoor has 4,487 interview questions and reports from Software engineer graduate interviews. Prepare for your interview. Get hired. Love your job.