Recent Interview Questions
- 0of 0 votes
AnswersGiven 2n points on a circle.find the number of ways to draw n non intersecting chords.
- NaiveCoder February 19, 2012 in India| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 2of 2 votes
AnswersGiven an array and an integer k , find the maximum for each and every contiguous sub array of size k.
- abc February 15, 2011
Sample Input :
1 2 3 1 4 5 2 3 6
3 [ value of k ]
Sample Output :
3
3
4
5
5
5
6| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - -1of 1 vote
AnswersFor Onsite Call: Epic will give you 10 questions to be done in 2 mins, 15 logical questions, and 20 questions related to MIIS programming language.
- MrNonMadison February 03, 2010
PLEASE NOTE, they hardly change the paper, so prepare these questions and expect them........
2 mins questions:
1) Vocation:Occupation
a) they are quite similar
b) they are quite opposite
c) not related| Report Duplicate | Flag | PURGE
Caritor Software Engineer / Developer Brain Teasers - 6of 6 votes
AnswersCode a function that receives a string composed by words separated by spaces and returns a string where words appear in the same order but than the original string, but every word is inverted.
Example, for this input string@"the boy ran"
the output would be
@"eht yob nar"
Tell the complexity of the solution.
- diegum June 06, 2014 in United States for iOS| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer String Manipulation - 22of 22 votes
AnswersYou are given an array of n integers which can contain integers from 1 to n only . Some elements can be repeated multiple times and some other elements can be absent from the array . Write a running code on paper which takes O(1) space apart from the input array and O(n) time to print which elements are not present in the array and the count of every element which is there in the array along with the element number .
- Kavish Dwivedi July 15, 2013 in India for Bangalore
NOTE: The array isn't necessarily sorted.| Report Duplicate | Flag | PURGE
Amazon SDE1 Arrays - 11of 11 votes
AnswersGiven a string, find whether it has any permutation of another string. For example, given "abcdefg" and "ba", it shuold return true, because "abcdefg" has substring "ab", which is a permutation of "ba".
- sg March 02, 2013 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test String Manipulation - 5of 5 votes
AnswersGiven a source string and a destination string write a program to display sequence of strings to travel from source to destination. Rules for traversing:
- Dee November 06, 2012 in United States
1. You can only change one character at a time
2. Any resulting word has to be a valid word from dictionary
Example: Given source word CAT and destination word DOG , one of the valid sequence would be
CAT -> COT -> DOT -> DOG
Another valid sequence can be
CAT -> COT - > COG -> DOG
One character can change at one time and every resulting word has be a valid word from dictionary| Report Duplicate | Flag | PURGE
Google Site Reliability Engineer - 0of 0 votes
AnswersGiven a sorted linked list, delete all duplicate numbers, leave only distinct numbers from original list. e.g., given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2->3, return 2->3.
- Anonymous July 28, 2009| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing Linked Lists - 3of 3 votes
AnswersGiven a value and a binary search tree.
- vodangkhoa April 24, 2007
Print all the paths(if there exists more than one) which sum up to that value. It can be any path in the tree. It doesn't have to be from the root.| Report Duplicate | Flag | PURGE
Microsoft Yahoo Software Engineer / Developer Trees and Graphs Coding Algorithm - -1of 3 votes
Answerswrite a method that takes in 2 int arrays of any size and returns an array that calculates the sum of both.
- J@sper November 26, 2015 in United States for -
for example, [1,2,3] and [2,3,4] will return [3,5,7]
Or [1,2,3] and [2,3,5,5] will return [2,4,7,8]
however, if it's like [9,9,2] and [0,1,3] you need to carry the sum so it returns as [1,0,0,5]
** SINGLE DIGIT ONLY| Report Duplicate | Flag | PURGE
Google Intern Arrays - 8of 8 votes
AnswersGiven the array of digits (0 is also allowed), what is the minimal sum of two integers that are made of the digits contained in the array.
- azil November 28, 2013 in United States
For example, array: 1 2 7 8 9. The min sum (129 + 78) should be 207| Report Duplicate | Flag | PURGE
Google Algorithm - 1of 1 vote
AnswersYou are given a huge log file which holds the entry and exit time of each person entering and exiting the office on a given day
- evolution monkey June 03, 2012 in United States
format of file:
entry time exit time
09:12:23 11:14:35
10:34:01 13:23:40
10:34:31 11:20:10
.
.upto N entries for a given day
Design a function which returns the total number of persons in the office at any given time. e.g input to function is 11:05:20.
The interviewer said he could call the function every second with input 11:05:20, 11:05:21,11:05:22, 11:05:23..........14:30:30
I really did not understand how to optimize the function.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 7of 7 votes
AnswersGiven a very long list of URLs, find the first URL which is unique ( occurred exactly once ).
- AK December 06, 2011 in India
I gave a O(n) extra space and O(2n) time solution, but he was expecting O(n) time, one traversal.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Large Scale Computing - 1of 1 vote
AnswersFind if a binary tree is bst
- anonym October 10, 2011 in -| Report Duplicate | Flag | PURGE
Amazon Flipkart Groupon Software Engineer / Developer Trees and Graphs - 0of 0 votes
AnswersHere is a tree. It's a binary tree but in no particular order. How do you write this tree to a file so that it can be reread in an reconstructed exactly as shown?
- Kartik February 24, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 5of 5 votes
AnswersGiven a number "n", find the least number of perfect square numbers sum needed to get "n"
- tazo March 12, 2015 in United States
Example:
n=12, return 3 (4 + 4 + 4) = (2^2 + 2^2 + 2^2) NOT (3^2 + 1 + 1 + 1)
n = 6, return 3 (4 + 1 + 1) = (2^2 + 1^2 + 1^2)| Report Duplicate | Flag | PURGE
Google Dynamic Programming - 3of 3 votes
AnswersQuestion: Given a sequence of positive integers A and an integer T, return whether there is a continuous sequence of A that sums up to exactly T
- ep February 27, 2015
Example
[23, 5, 4, 7, 2, 11], 20. Return True because 7 + 2 + 11 = 20
[1, 3, 5, 23, 2], 8. Return True because 3 + 5 = 8
[1, 3, 5, 23, 2], 7 Return False because no sequence in this array adds up to 7| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 6of 6 votes
AnswersGiven an array of ages (integers) sorted lowest to highest, output the number of occurrences for each age.
- streamer December 31, 2014 in United States
For instance:
[8,8,8,9,9,11,15,16,16,16]
should output something like:
8: 3
9: 2
11: 1
15: 1
16: 3
This should be done in less than O(n).| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - -4of 6 votes
AnswersYou have an array of integers(size N), such that each integer is present an odd number of time, except 3 of them(which are present even number of times). Find the three numbers.
- gdg June 21, 2014 in United States for Bing
Only XOR based solution was permitted.
Time Complexity: O(N)
Space Complexity: O(1)
Sample Input:
{1,6,4,1,4,5,8,8,4,6,8,8,9,7,9,5,9}
Sample Output:
1 6 8| Report Duplicate | Flag | PURGE
Google Developer Program Engineer Arrays - 25of 27 votes
AnswersGiven a large network of computers, each keeping log files of visited urls, find the top ten of the most visited urls.
- chandeepsingh85 September 26, 2013 in United States
(i.e. have many large <string (url) -> int (visits)> maps, calculate implicitly <string (url) -> int (sum of visits among all distributed maps), and get the top ten in the combined map)
The result list must be exact, and the maps are too large to transmit over the network (especially sending all of them to a central server or using MapReduce directly, is not allowed)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer System Design - 0of 2 votes
AnswersUse SIMPLE LOGIC for Converting this string str="aaabbccc" into str="3a2b3c".
- Anonymous September 23, 2013 in United States
###Note:###
I gave 3 diff solutions to interviewer with loops,conditions etc.,But he wanted a real OPTIMAL SOLUTION..lets see who ll write!!!!!| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer - 3of 5 votes
AnswersGiven two singly linked list, find if they are intersecting. Do this in single iteration. Also find the intersecting node in O(n) time and O(1) space. By intersection I mean intersection by reference not by value
- dm December 05, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Microsoft Software Engineer / Developer Linked Lists - 1of 1 vote
AnswersGiven preorder traversal array of a BST, recontruct the BST.
- jiangok2006 July 26, 2012 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 0of 0 votes
AnswersThere is a building of 100 floors. If an egg drops from the Nth floor or above it will break. If it's dropped from any floor below, it will not break. You're given 2 eggs. Find N, and minimize the number of drops for the worse case.
- vodangkhoa December 13, 2006| Report Duplicate | Flag | PURGE
Microsoft Highbridge Capital Software Engineer / Developer Financial Software Developer Brain Teasers Algorithm - 1of 1 vote
AnswersYou are tasked with implementing a method that returns the lowest possible number that could be generated after removing n characters from a string of digits. The method signature should look like:
public static string GenerateLowestNumber(string number, int n)
Where the number parameter is a string that contains a number (e.g. “4205123”), and the n parameter represents the number of characters to remove from the string. The goal of this method is to return the lowest number that can be generated by removing n characters from the number provided while keeping the positions of the remaining characters relative to each other the same (i.e. the method should remove n characters from the string, but it cannot re-order the characters).
- JSDUDE March 14, 2015 in United States for Cloud + Enterprise
For example, if number is “4205123” and n is 4, the lowest possible number that can be generated after removing any 4 characters is “012”. If number is “216504” and n is 3, the lowest possible number that can be generated after removing 3 characters is “104”.| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm String Manipulation - 7of 7 votes
AnswersDetermine minimum sequence of adjacent values in the input parameter array that is greater than input parameter sum.
- bootcat April 20, 2014 in United States
Eg
Array 2,1,1,4,3,6. and Sum is 8
Answer is 2, because 3,6 is minimum sequence greater than 8.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
Answers1. A
- amklo December 30, 2010
2. Ctrl+A
3. Ctrl+C
4. Ctrl+V
If you can only press the keyboard for N times (with the above four keys), please write a program to produce maximum numbers of A. If possible, please also print out the sequence of keys.
So the input parameter is N (No. of keys that you can press), the output is M (No. of As that you can produce).| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 3 votes
AnswersGiven a random string S and another string T with unique elements, find the minimum consecutive sub-string of S such that it contains all the elements in T.
- Saghar H November 05, 2015 in United States
example:
S='adobecodebanc'
T='abc'
answer='banc'| Report Duplicate | Flag | PURGE
Facebook Software Developer Algorithm - 4of 4 votes
AnswersGiven a string S, you are allowed to convert it to a palindrome by adding 0 or more characters in front of it.
- xyz_coder November 20, 2014 in United States
Find the length of the shortest palindrome that you can create from S by applying the above transformation.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer