Recent Interview Questions
- 4of 4 votes
AnswersGiven an integer array. Perform circular right shift by n.
- wolfengineer November 09, 2013 in United States
Give the best solution.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays - 2of 2 votes
AnswersGiven an array of integers . Write an algorithm to find all the Pythagorean triples.
- Raj August 31, 2013 in India
Eg : i/p : int arr[ ] = {1,3,4,5,6,7,8,10,11}
o/p: Print 3,4,5 and 6,8,10| Report Duplicate | Flag | PURGE
Amazon - 10of 10 votes
AnswersConsider a hash table with M slots. Suppose hash value is uniformly distributed between 1 to M, and it uses linked list to handle conflicts (if two keys hashed to the same slot). Suppose we put N keys into this M-slotted hash table, what is the probability that there will be a slot with i elements? i could vary from 0 to N.
- seanren7 August 13, 2013 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Hash Table - 6of 12 votes
AnswersGiven a list of integers, find out the biggest interval that has all its members in the given list. e.g. given list 1, 7, 4, 6, 3, 10, 2 then answer would be [1, 4]. Develop algorithm and write code for this
- prongs July 08, 2013 in India| Report Duplicate | Flag | PURGE
Google Applications Developer Algorithm Arrays C++ Coding - 0of 0 votes
AnswersFlatten a List<List<Integer>> in Java and implement the hasNext() and next() methods.
- Ana April 23, 2013 in United States
e.g. [[6,8],4] should return true when at 6, 8 and false at 4.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 1of 1 vote
AnswersGiven a String "abcxrrxabcrr"
- vigneshselvakumar January 10, 2013 in United States
Find the first repeated string with minimum 3 character?
Answer is "abc" min 3 characters.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ - 0of 0 votes
AnswersDesign an algorithm to find the least common ancestor of two nodes in a Binary tree(Note: Its not a binary search Tree)
Node Structure is given as
- teja.sbt November 07, 2012 in United States for KindleClass Node{ int data; Node leftchild; Node Rightchild; }
| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Algorithm - 0of 0 votes
AnswersGiven two trees, how do you find one of the tree is a subtree of other?
- hari@hbiz.in August 26, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Development Manager Algorithm Data Structures Trees and Graphs - 0of 0 votes
AnswersYou have 8 coins. 3 of them weigh x units, 3 y units, 1 a units and 1 b units. They are all mixed and look identical. You have to find the lightest coin in minimum number of weighing .
- amnesiac July 31, 2012 in India| Report Duplicate | Flag | PURGE
Oracle Software Engineer / Developer Brain Teasers - 0of 0 votes
Answerssearch an element in sorted 3D Array .(Sorted in all the 3 directions) .
- Shobhit July 20, 2012 in United States
best time complexity (less than O(n^2))| Report Duplicate | Flag | PURGE
Amazon C - 0of 0 votes
AnswersGiven two integer unsorted arrays, your task is to compare the BST formed by both the arrays.
- shivi116 June 30, 2012 in India
any o(n) solution???| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures - 0of 0 votes
AnswersFind the(two) nodes which are at maximum distance in a binary tree?
- grave May 31, 2012 in India
This is not finding the distance but the nodes which are farthest.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Data Structures Trees and Graphs - 3of 3 votes
AnswersFind the seed of a number.
- flash March 23, 2012 in United States
Eg : 1716 = 143*1*4*3 =1716 so 143 is the seed of 1716. find all possible seed for a given number.| Report Duplicate | Flag | PURGE
Epic Systems - 2of 2 votes
AnswersSay there is a string hllsacefgdbdfdfdffd
- tarun.aggarwaltarun March 17, 2012 in India
You need to find the biggest string that has all consecutive characters
Conditions
consecutive string might have jungled words i.e acb is also continous or bcad is also continuous| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 3of 3 votes
AnswersCount smaller elements on right side
- NaiveCoder February 27, 2012 in India
eg : [4,12,5,6,1,34,3,2]
o/p [3,5,3,3,0,2,1,0]| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 0 votes
AnswersGive two binary search trees, print the numbers of both together in ascending order.
- Softy July 21, 2011| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a binary matrix of N X N of integers , you need to return only unique rows of binary arrays
- Rahul June 09, 2011
eg:
0 1 0 0 1
1 0 1 1 0
0 1 0 0 1
1 1 1 0 0
ans:
0 1 0 0 1
1 0 1 1 0
1 1 1 0 0| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Data Structures Matrix - 0of 0 votes
Answersfind next palindrome of a number.
- Anonymous December 12, 2010
eg 125 next palindrome is 131| Report Duplicate | Flag | PURGE
Microsoft - 1of 1 vote
Answers2,2,4,11,_
- Amanat Ali October 26, 2010
Find the next number in the series.No more clues.
[I had 1 hour and gave many possible answers like 50,28,67 and 18 but could not convince them. This is such a short series.]| Report Duplicate | Flag | PURGE
ThoughtWorks Software Engineer / Developer - 0of 0 votes
AnswersYou have an array like ar[]= {1,3,2,4,5,4,2}. You need to create another array ar_low[] such that ar_low[i] = number of elements lower than or equal to ar[i] in ar[i+1:n-1].
- abc July 09, 2010
So the output of above should be {0,2,1,2,2,1,0}
Time complexity : O(n)
use of extra space allowed.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersYou r given a large string of characters lets call it Sbig. Then there is a small set of characters lets call it Ssmall. You have to find smallest substring of Sbig which contains all characters in Ssmall.
- GoogleInterview January 10, 2010
For example you are given Sbig = "hello what are you doing"
Ssmall= "eo"
answer is "ello"| Report Duplicate | Flag | PURGE
Google Directi Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite second most repeating word in a string
- hello world June 28, 2017 in United States
eg aaa bbb ccc aaa bbb aaa
answer - bbb| Report Duplicate | Flag | PURGE
Amazon SDET - 3of 3 votes
AnswersGiven an input string and ordering string, need to return true if the ordering string is present in Input string.
- ranjith2jeeth August 04, 2016 in United States
input = "hello world!"
ordering = "hlo!"
result = FALSE (all Ls are not before all Os)
input = "hello world!"
ordering = "!od"
result = FALSE (the input has '!' coming after 'o' and after 'd', but the pattern needs it to come before 'o' and 'd')
input = "hello world!"
ordering = "he!"
result = TRUE
input = "aaaabbbcccc"
ordering = "ac"
result = TRUE| Report Duplicate | Flag | PURGE
Uber Software Engineer String Manipulation - 0of 0 votes
Answers// Reverse the words. Given a String that contains words separated by single space, reverse the words in the String. You can assume that no leading or trailing spaces are there.
// For example: "Man bites dog" => "dog bites Man”
- almunayer May 10, 2016 in United StatesString reverseWords(String value) { // Insert implementation }
| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm