Recent Interview Questions
- 2of 2 votes
AnswersUser inputs a sequence of digits. Every digit is a keystroke, that is equivalent to some character out of a sequence of characters. Digit zero and five mean NULL. The table is given below
- ranechabria July 14, 2012 in United States
0 - NULL
1 - v, t, f, r, q
2 - f, t, k
3 - w, z, b, g
4 - r, s
5 - NULL
6 - f, i, r
7 - p
8 - l, o
9 - p
Generate all possible character sequence for a given sequence of digits.
Ex - If the user input 9801, your program should generate
{plv, plt, plf, plr, plq, pov, pot, pof, por, poq} (not necessarily in this order).
This problem is somewhat similar to the SMS problem. It basically boils down to generating a cartesian product of the character sets corresponding to keys.| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Algorithm Coding Data Structures - 2of 2 votes
AnswersIn a string detect the smallest window length with highest number of distinct characters. For eg.
- neer.1304 September 12, 2015 in United States
A = “aabcbcdbca”, then ans would be 4 as of “dbca”| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 2of 2 votes
AnswersI have two arrays A and B(each containing 8 bit integers). Find the common elements between them.
- puneet.sohi April 28, 2014 in United States for AWS
The questions started out as a general discussion with the most inefficient method. Then the interviewer asked me to improve the solution (to give a NlogN and finally a linear time solution)| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 2of 2 votes
Answersimplement division without using division operator in log(n) time.
- !@# April 22, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 2of 2 votes
AnswersGiven an integer, print out all the prime numbers smaller than that integer.
- tielongs October 31, 2013 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern Algorithm - 2of 2 votes
AnswersFrom a given integer array values, find if a Total value is possible or not? The numbers in the array can be used more than once.
- struggler July 29, 2013 in United States
example
int[] points = {3, 7};
isScorePossible(points, 10) => true
isScorePossible(points, 9) => true| Report Duplicate | Flag | PURGE
Yelp Software Engineer / Developer - 2of 2 votes
AnswersGiven a set of numbers from 1 to n squared, generate unique sub-sets consisting of n numbers such that each subset has one and only one matching number from any other sub-set
- msjob99 April 11, 2012 in United States
The max number of sub-sets is n squared + n
An example is as follows:
n = 3
n squared set = 1, 2, 3, 4, 5, 6, 7, 8, 9
sub-set 1 = 1, 2, 3
sub-set 2 = 1, 4, 7
sub-set 3 = 1, 5, 9
sub-set 4 = 1, 6, 8
sub-set 5 = 2, 5, 8
sub-set 6 = 2, 4, 9
sub-set 7 = 2, 6, 7
sub-set 8 = 3, 6, 9
sub-set 9 = 3, 5, 7
sub-set 10 = 3. 4, 8
sub-set 11 = 4, 5, 6
sub-set 12 = 7, 8, 9
Write the C++ algorithm that will work for any arbitrary integer value n. The n-squared set can be placed into any built in C++ data structure eg 2d array.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 2of 2 votes
AnswersFind the largest substring palindrome in a given string.
- revanthpobala October 01, 2015 in United States
ex: input: abbac output: abba
Solution: Use Hashmap| Report Duplicate | Flag | PURGE
Amazon SDET Algorithm - 2of 2 votes
AnswersGiven an array and is rotated n number of times find the number where the peak happens. The array is sorted in increasing order. Follow up question: how will you rearrange them in normal sorted order.
- madhur.eng June 03, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer - 2of 2 votes
AnswersPrint a tree in Level Order with a newline after each depth
- PrateekS. July 29, 2014 in United States/** * Sample input: * * 1 * / \ * 3 5 * / \ \ * 2 4 7 * / \ * 9 8 * * Expected output: * 1 * 3 5 * 2 4 7 * 9 8 * ========== */
| Report Duplicate | Flag | PURGE
Linkedin Algorithm - 2of 2 votes
AnswersYou are given numbers from 1 through 100 in an array, there is one number missing, find that one
- juny January 26, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 2of 2 votes
Answers5! = 5 * 4 * 3 * 2 * 1 = 120 (it contains 1 zero).
- pal January 22, 2014 in India
How many zeroes will be contained in 100! then.
Explain with logic.| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Problem Solving - 2of 2 votes
AnswersYou can swap only two consecutive elements. You have to show all steps to convert a string into another string (both strings will be anagrams of each other). E.g. GUM to MUG
- codr December 21, 2013 in United States
GUM
GMU
MGU
MUG| Report Duplicate | Flag | PURGE
Epic Systems SDE1 Algorithm - 2of 2 votes
AnswersWAP to sort prime numbers smaller than given N by digits. If N is 40, the output should be 11, 13, 17, 19, 2, 23, 29, 3, 31, 37, 39, 5, 7.
- lngbrc October 24, 2013 in United States
Follow-up question: limit memory usage.| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Math & Computation - 2of 2 votes
Answers1000 elements in one bag and 1 million elements in another. how do you find common elements among them. Also give the complexity of your solution.
- sivaji8 September 27, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 2of 2 votes
AnswersFollowing sequence is given:
- SK July 07, 2013 in India
1,2,3,4,5,6,8,9,10,12,15,16,18,20,24
In this sequence, each number is multiple of 2,3 or 5 only.
This sequence does not contain 7 & 14 as these number has sequence 7 as multiple.
So, if you are given N find the Nth number of this sequence.| Report Duplicate | Flag | PURGE
Flipkart Senior Software Development Engineer Algorithm - 2of 2 votes
AnswersIn a BST, I want to replace all nodes with value which is the sum of all the nodes which are greater than equal to the current node.
- Abhishek Shrivastava April 20, 2013 in United States
5
2 10
Output -->
15
17 10| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 2of 2 votes
AnswersDesign a data structure where the following 3 functions are optimised:
- P October 28, 2011 in India
1. Insert(n)
2. GetRandomElement()
3. Remove(n)
Write a class, and implement the functions. Give complexity of each of these ..| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Application / UI Design - 2of 2 votes
AnswersGiven an array of length N. How will you find the minimum length
- abhishek October 19, 2010
contiguous sub - array of whose sum is S and whose product is P . Here
S and P will be given to you.
was asked in YAHOO CODING ROUND interview| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Algorithm - 2of 2 votes
AnswersConvert a number to English representation.
- coder145 August 09, 2016 in United States
Ex: Input : 100
Output : One Hundred.| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 2of 2 votes
AnswersThere are n+1 loading docks. a permutation of boxes 1->n is placed on the first n. there is a fork that can move one box to an empty location at a time. Give an algorithm to sort then boxes with minimum number of moves.
- ad09 August 05, 2016 in United States
Follow up: minimum distance| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 2of 2 votes
AnswersGiven an array arr[] of size n. Three elements arr[i], arr[j] and arr[k] form an inversion of size 3 if a[i] > a[j] >a[k] and i < j < k. Find total number of inversions of size 3
- tihor December 29, 2015 in India
e.g.
Input: 23, 10, 24, 7, 12, 19
Ans: 23, 10, 7| Report Duplicate | Flag | PURGE
Deshaw Inc Applications Developer - 2of 2 votes
AnswersYou are given printouts from an algorithm which ran over an unsorted binary tree. One printout is from an in-order run and another from a pre-order run. Can you reconstruct the tree? If so, then write an algorithm.
- tested.candidate March 22, 2015 in UK| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersYou have 81 balls. 80 balls have the same weight. 1 ball is the lightest one. What would be the minimum possible way to find the lightest ball ?
- AlgoBaba November 23, 2014 in United States
(Use Dynamic Programming)| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Dynamic Programming - 2of 2 votes
AnswersWrite code to get maximum and second maximum element of a stack. The given function should be in O(1) complexity . Later extend for finding kth max in O(1).
- Nascent November 08, 2014 in India| Report Duplicate | Flag | PURGE
Google - 2of 2 votes
AnswersFind the largest sum contiguous sub array. The length of the returned sub array must be at least of length 2.
- phoenix September 19, 2014 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Algorithm - 2of 2 votes
AnswersYou have 10 million IP addresses. (IPv4 4 byte addresses). Create a hash function for these IP addresses.
- Aasen October 30, 2013 in United States
Hint: Using the IP's themselves as a key is a bad idea because there will be a lot of wasted space.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Intern - 2of 2 votes
AnswersFind the largest k numbers in an enormous array of numbers. You cannot sort the array. Give the run time of the algorithm.
- jielei.wang.0316 October 25, 2013 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Application Engineer Algorithm - 2of 2 votes
AnswersYou are given a grid, with points on the intersections (think a map of streets, people are standing on random corners). Write code to calculate the point on the grid that is the shortest distance from every point on the grid.
- chandeepsingh85 September 26, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Trees and Graphs