Programming Interview Questions | Glassdoor

Programming Interview Questions


interview questions shared by candidates

Programming Interview Questions

Sort: RelevancePopular Date

What is your current employer doing better than we are? I work in marketing so I had to answer based on my research done prior to interview. I was so happy I did a ton of research/comparison before going in.

1 Answer

They do a better job of promoting and communicating their programs.

Number of 1's in binary representation of integer?

13 Answers

Write a function that divides two numbers without using the divide '/' operator.

11 Answers

Implement a function to validate whether a given binary tree is a BST (i.e. write an isBST() function).

9 Answers

List all anagrams in a file. Assumptions: case-insensitive, a-z characters only, one word per line. For example, if the file contains dog, cat, ddd, goo, act, god -- output dog, god, act, cat

10 Answers

Given a string find the first non-repeated character.

10 Answers

Given a matrix print it clockwise from the first element to the very inner element.

6 Answers

You are given an integer N and an integer M. You are supposed to write a method void findBestCoinsThatMinimizeAverage(int N, int M) that prints the best collection of N coins that minimize the average number of minimum coins needed to generate values from 1 to M. So, if M = 100, and N = 4, then if we use the set {1, 5, 10, 25} to generate each value from 1 to 100, so that for each value the number of coins are minimized, i.e. 1 = 1 (1 coin), 2 = 1 + 1 (2 coins),..., 6 = 1 + 5 (2 coins), ..., 24 = 5 + 5 + 5 + 5 + 1 + 1 + 1 + 1 (8 coins), and we take the average of these coins, we would see that the average comes out to ~5.7. But if we instead use {1, 5, 18, 25}, the average would come out to be 3.7. We are to find that set of N coins, and print them, that produce the minimum average.

8 Answers

You are given an array with n positive integers where all values in the array are repeated except for one. Return the one that is not repeated.

11 Answers

I have a log that consists of more than 100 million lines. Each line is just a data about user login, login time, etc. I want to sort them based on user login, and then if there is a tie based on login time, etc. However, I have limited memory, so don't think of storing all of them in an array. The memory can only hold n data where n is much smaller than 100 millions. You can access the disk though although it is much slower. How will you do it so that it is as efficient as possible?

5 Answers
110 of 212 Interview Questions