Software Engineer Interview Questions

466,396 software engineer interview questions shared by candidates

* You have a data structure of integers, which can be negative, zero, or positive, and you need to support an API with two public methods, insert(int) and getmedian(). Describe a data structure you would use to support this API and describe the running time of the two methods. * Imagine you're writing a function that takes an array of integers and an integer and it needs to return true if any pair in the array sum to the 2nd argument. The array can have negative numbers, zero, or positive numbers. Describe how you would design this function and what its running time would be. I ran through the trivial n^2 solution, then modified it to an nlogn and finally to a linear solution.
avatar

Software Engineer

Interviewed at Google

4.4
Nov 7, 2009

* You have a data structure of integers, which can be negative, zero, or positive, and you need to support an API with two public methods, insert(int) and getmedian(). Describe a data structure you would use to support this API and describe the running time of the two methods. * Imagine you're writing a function that takes an array of integers and an integer and it needs to return true if any pair in the array sum to the 2nd argument. The array can have negative numbers, zero, or positive numbers. Describe how you would design this function and what its running time would be. I ran through the trivial n^2 solution, then modified it to an nlogn and finally to a linear solution.

Another was a puzzle: A king orders 100 bottles of wine for a celebration. A courtier who's angry with the king over something puts poison in one of those bottles. The king has a way of identifying the poisoned bottle by giving a few drops of wine to a monkey. Since the poison is fast acting, the monkey will die immediately. Whats the minimum number of monkeys needed to find the poisoned bottle?
avatar

Senior Software Developer

Interviewed at Tower Research Capital

4.1
Jun 7, 2010

Another was a puzzle: A king orders 100 bottles of wine for a celebration. A courtier who's angry with the king over something puts poison in one of those bottles. The king has a way of identifying the poisoned bottle by giving a few drops of wine to a monkey. Since the poison is fast acting, the monkey will die immediately. Whats the minimum number of monkeys needed to find the poisoned bottle?

Question Description: Write a function that, given a list of integers (both positive and negative) returns the sum of the contiguous subsequence with maximum sum. Thus, given the sequence (1, 2, -4, 1, 3, -2, 3, -1) it should return 5.
avatar

Software Engineer Intern

Interviewed at LinkedIn

3.8
Dec 4, 2014

Question Description: Write a function that, given a list of integers (both positive and negative) returns the sum of the contiguous subsequence with maximum sum. Thus, given the sequence (1, 2, -4, 1, 3, -2, 3, -1) it should return 5.

Write a program that given 4 coin denominations and a dollar amount finds the best way to express that amount using the coins given. I.e. you have coins with denominations of 1c, 7c, 13c,19c and you have to express $2.12 with the least number of coins. There is always a 1c coin but the other 3 are arbitrary.
avatar

Software Engineer

Interviewed at Tripadvisor

3.6
Apr 27, 2012

Write a program that given 4 coin denominations and a dollar amount finds the best way to express that amount using the coins given. I.e. you have coins with denominations of 1c, 7c, 13c,19c and you have to express $2.12 with the least number of coins. There is always a 1c coin but the other 3 are arbitrary.

Viewing 291 - 300 interview questions

Glassdoor has 466,396 interview questions and reports from Software engineer interviews. Prepare for your interview. Get hired. Love your job.