Software engineer internship Interview Questions |

Software engineer internship Interview Questions


software engineer internship 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?

I show them my IOT project which works with the MQTT protocol. They ask what other protocols are available for IOT.

4 Answers

Give a range of numbers, return 6 different numbers randomly. In O(n).

3 Answers

Enumerate the following from 1 to 4, being 1 the fastest to execute and 4 the slowest: - read cpu register - disk seek - context switch - read from main memory

3 Answers

find a number in a sorted array and then find the number in an unsorted array ?They will unsort the array on their own .

4 Answers

Implement a function to simplify a unix based path. Example: input: /a/b/../c/. output: /a/c

2 Answers

Write a simple cipher that will take a string and replace each letter in the range a-z with the corresponding character 13 steps along the alphabet.

2 Answers

Nothing special ...basic questions about my CV. They asked about why you would use SQL stored procedure instead of SQL script in the web application

2 Answers

How would you group some data given only the number of groups you want to end up have

3 Answers

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

You have 50 balls, half white and half black. You have to put all the balls in two boxes and then I choose one ball from any of the boxes without seeing. If I choose a black ball I win, if I choose a white one you win. How would you distribute the balls in the boxes in such way that you have more odds to win.

2 Answers
110 of 1,703 Interview Questions