Software engineering Interview Questions | Glassdoor

Software engineering Interview Questions


interview questions shared by candidates

Software engineering Interview Questions

Sort: RelevancePopular Date

how to find the closest 2 number in an array of unique positive number

5 Answers

asked during phone interview

One solution is to sort the array, then iterate through all neighboring pairs to find the pair with smallest difference. This is O(NlogN) solution. If the integers are bounded, you may be able to sort in O(N) time for an O(N) solution.

public static int[] find2Closest(int[] myArray) { assert(myArray.length >= 2): "myArray needs to be larger than 2"; Arrays.sort(myArray); //quickSort int indexMin1 = 0; int indexMin2 = 1; int min = myArray[indexMin1] - myArray[indexMin2]; for(int k = 0; k < myArray.length-1; k++) { int difference = Math.abs(myArray[k] - myArray[k+1]); if(difference < min) { min = difference; indexMin1 = k; indexMin2 = k+1; } } int[] values = new int[2]; values[0] = myArray[indexMin1]; values[1] = myArray[indexMin2]; return values; }

2 ways of factorial or Fibanacci number calculation

1 Answer

Array based stack and queue.

1 Answer

Please explain in as much details as possible what happens when you click link in the browser and this request goes to web app and returns back as response.

1 Answer

The SQL quiz is pretty easy to solve if you are on a live db. But without being prepared for a paper quiz, you may not be able to prove your skills

1 Answer

Implement a stack that supports push, pop and mode(the one from statistics) operation. Gave an O(log n ) push and pop and O(1) mode operation.Another good question was implement atoi function. I assumed it as base 10 but was asked to support from binary to any base numbers(even base 50).

2 Answers

Apache handlers - explain how pre- and post-processing works for web server requests and responses.

110 of 17 Interview Questions