Algorithm Interview Questions | Glassdoor

Algorithm Interview Questions

768

interview questions shared by candidates

Algorithm Interview Questions

Sort: RelevancePopular Date

(a) first, write a function to calculate the hamming distance between two binary numbers (b) write a function that takes a list of binary numbers and returns the sum of the hamming distances for each pair (c) find a solution for (b) that works in O(n) time.

10 Answers

Print a singly-linked list backwards, in constant space and linear time.

10 Answers

Convert a binary search tree to a sorted, circular, doubly-linked list, in place (using the tree nodes as the new list nodes).

8 Answers

Describe a routine which returns the set of integers in {1..100} divisible without remainder by 3 but not by 9.

12 Answers

Given a list of integers, some of which may be negative, extract the pair that sums to the largest number.

8 Answers

How would you find the pairs of numbers that added to some specific number in an array.

7 Answers

If you have a file containing millions of integers, how would you sort the data in the file using extremely limited resources, such a s 1GB of memory?

8 Answers

There are n pots with different # gold coins in them. Two players play a game, where each player can select a pot at either ends. maximize the gold

7 Answers

Implement the "see and tell" algorithm with a given seed number x and a number of iterations y. Output the result on iteration y

10 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
1120 of 768 Interview Questions