Software Engineer Interview Questions | Glassdoor.ie

Software Engineer Interview Questions

661

Software engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

you have array with n elements. How would you do circular shift of k positions? Time and space complexity?

6 Answers

Make a circular linklist, and move headpointer K position to do K shifts. It's O(n) time complexity. Space is contant. (circular link list).

Well, space isn't constant because you took an array and then copied it somehow to a linked list. Remember, you were given an array? If I understand the question correctly, they're asking to do a circular shift of some range of values, like the first k values in an array of length n? So if you wanted to shift right, temp = array[k] from index=k to 1 array[index] = array[index-1] array[0] = temp this would be O(k)? I mean, it would take k steps, but maybe it's somehow still O(n)

oh, sorry, I misunderstood. Not k values, move everything k positions. Praveen Chettypally's answer works but the space complexity would be O(n) since there is a fully copy of the list? The simplest would probably be to make another array and copy in, starting at the (n-k)th element, going to the end, then starting at the beginning. A second array would probably be a better option than a completely different data structure. What if it has to be done in place? is there an O(n) solution?

Given the root of a binary search tree, link all the nodes at the same level, by using an additional Node* level.

2 Answers

difference between "hashing a string" and "encrypting a string". Then: is it possible to find two elements for which the hash is the same?

2 Answers

Find exist in maze or prove its non existence.

3 Answers

You have dictionary. How would you design function/system that should return true/false for check if a word is in a database? How would you scale your solution if word db does not fit in memory/disk? How would you scale it to really big db of words that should be located on n computers?

2 Answers

Compute all the intersections of two sets of segments in a line.

2 Answers

Given a set of cities, each with a given population, select randomly a city with a probability that is proportional to the population.

2 Answers

You have a project and you want to release it in multiple languages. For every language you have a resource file which contains hotkeys of every Module. For example: one module is File which has Find with hotkey F and Free with hotkey F and another module Edit which has Replace with hotkey R. For every module you want to find the colliding Hotkeys. In our example in module File: Find and Free have colliding hotkey "F". In the resource file a hotkey is coded as: \alpha"F"Find.Files; where \alpha is one character: alpha. You have 100 languages and around 6000 hotkeys in a resource file. Determine all the colliding hotkeys.

1 Answer

How many years experience have you with C#.

1 Answer

How many years experience have you with SQL Server

1 Answer
110 of 661 Interview Questions