Senior Developer Interview Questions | Glassdoor.ca

Senior Developer Interview Questions

549

Senior developer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Given an array of int[] like 1,2,3 Find the next largest integer than can be made with these digits (e.g.: 2,1,3)

5 Answers

Wrote code in C# to solve the problem in a generic case. Think about this situation: 5,9,8,7,6,4,3,1,2 -> 5,9,8,7,6,4,3,2,1 followed by 5,9,8,7,6,4,3,2,1 -> 6,1,2,3,4,5,7,8,9.

// Typescript implementation // Assumption 1: all numbers in the input array are single digits, i.e. between 0 and 9 // Assumption 2: if a larger number cannot be found then return the current number as is const getNextLargestNumber = (inputs: number[]): number => { if (inputs) { // Do not mutate the initial inputs let copiedInputs: number[] = inputs.slice(); // Loop through the digits in reverse order // Exclude the first digit for (let i = copiedInputs.length - 1; i >= 1; i--) { // Loop through the previous digits for (let j = i - 1; j >= 0; j--) { const swapFrom: number = copiedInputs[i]; const swapTo: number = copiedInputs[j]; // Swap if a smaller digit is found before if (swapTo x - y)]; return convertArrayToNumber(copiedInputs); } } } } return convertArrayToNumber(inputs); }; const convertArrayToNumber = (inputs: number[]): number => { let num: number = 0; if (inputs) { const inputsLength: number = inputs.length; for (let i = 0; i < inputsLength; i++) { // Use index to determine the power of 10 num += inputs[i] * (10 ** (inputsLength - i - 1)); } } return num; }; console.log(getNextLargestNumber([4, 1, 9, 5])); console.log(getNextLargestNumber([4, 5, 1, 9])); console.log(getNextLargestNumber([4, 5, 9, 1])); console.log(getNextLargestNumber([4, 9, 1, 5])); console.log(getNextLargestNumber([4, 9, 5, 1])); console.log(getNextLargestNumber([5, 1, 4, 9])); console.log(getNextLargestNumber([1, 4, 2, 4, 3, 8, 6, 4, 0])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 6, 8])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 8, 6])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 6, 3, 8])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 1, 2])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 2, 1])); console.log(getNextLargestNumber([6, 1, 2, 3, 4, 5, 7, 8, 9])); console.log(getNextLargestNumber([6])); console.log(getNextLargestNumber([6, 5])); console.log(getNextLargestNumber([5, 6]));

// Wrong copy-paste // Corrected version // Typescript implementation // Assumption 1: all numbers in the input array are single digits, i.e. between 0 and 9 // Assumption 2: if a larger number cannot be found then return the current number as is const getNextLargestNumber = (inputs: number[]): number => { if (inputs) { // Do not mutate the initial inputs let copiedInputs: number[] = inputs.slice(); // Loop through the digits in reverse order // Exclude the first digit for (let i = copiedInputs.length - 1; i >= 1; i--) { // Loop through the previous digits for (let j = i - 1; j >= 0; j--) { const swapFrom: number = copiedInputs[i]; const swapTo: number = copiedInputs[j]; // Swap if a smaller digit is found before if (swapTo x - y)]; return convertArrayToNumber(copiedInputs); } } } } return convertArrayToNumber(inputs); }; const convertArrayToNumber = (inputs: number[]): number => { let num: number = 0; if (inputs) { const inputsLength: number = inputs.length; for (let i = 0; i < inputsLength; i++) { // Use index to determine the power of 10 num += inputs[i] * (10 ** (inputsLength - i - 1)); } } return num; }; console.log(getNextLargestNumber([4, 1, 9, 5])); console.log(getNextLargestNumber([4, 5, 1, 9])); console.log(getNextLargestNumber([4, 5, 9, 1])); console.log(getNextLargestNumber([4, 9, 1, 5])); console.log(getNextLargestNumber([4, 9, 5, 1])); console.log(getNextLargestNumber([5, 1, 4, 9])); console.log(getNextLargestNumber([1, 4, 2, 4, 3, 8, 6, 4, 0])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 6, 8])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 3, 8, 6])); console.log(getNextLargestNumber([1, 4, 2, 4, 4, 0, 6, 3, 8])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 1, 2])); console.log(getNextLargestNumber([5, 9, 8, 7, 6, 4, 3, 2, 1])); console.log(getNextLargestNumber([6, 1, 2, 3, 4, 5, 7, 8, 9])); console.log(getNextLargestNumber([6])); console.log(getNextLargestNumber([6, 5])); console.log(getNextLargestNumber([5, 6]));

write a c# method to bring pairs of integers that sum up to 10 from an array of integers.

3 Answers

The following code creates an unnecessary temporary variable. How would you change it to be more efficient? C++ code that searches an unsorted list...

2 Answers

Almost all behavioral questions were unexpected because in other companies it is usually reserved for HR round, not technical.

2 Answers

What you do if you cannot get something from upper management you need?

2 Answers

What would the count for the list of it. public class Test { string Data; int Id; public Test(int id, string data) { Data = data; Id = id; } } static void Main(string[] args) { List list = new List(); list.Add(new Test(10, "test")); var d = new Test(10, "test"); if (!list.Contains(d)) list.Add(d); Console.WriteLine("Count of the list is : " + list.Count); Console.ReadLine(); } } What to do to make count 1?

2 Answers

Why two calls to printf with same parameters were giving completely different results?

2 Answers

Design the data model and API for a customer survey.

2 Answers

I was given a code to review. I have fixed bugs in their code, made it work, and put detailed comments to all modified lines of code plus detailed comments outside of the code describing what was done and why. The answer was that their student could not understand the comments. Hm, I guess the student should be taught better and I didn't apply for a teacher position. They refused to give me detailed answer, but after all I wasn't sure I wanted it. What a company where students decide whether to hire seniors. After some thinking I've concluded that I was simply used as a free independent code reviewer. If you are experienced developer, avoid these guys, they will pretend they are hiring you, but in fact will just use you. If you are freshly graduated, lazy and not knowledgeable, you can go there, they will teach you how to illegally make others do your job for you.

2 Answers

Why we should hire you?

2 Answers
110 of 549 Interview Questions