Coding Interview Questions
- 0of 0 votes
AnswersGenerate all possible unique 4 digit numbers such that no two adjacent numbers are the same and any number starting with 4 should end with a 4 . eg 1234 , 1232 are both correct but 1223 is not .
- fchristopher239 November 23, 2011 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven an NxN matrix with unique integers : Find and print positions of all numbers such that it is the biggest in its row and also the smallest in its collumn .
- fchristopher239 November 23, 2011 in United States
eg : In 3 x 3 with elements
1 2 3
4 5 6
7 8 9
the number is 3 and position (2,2)| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Coding - 0of 0 votes
AnswersHow to print given Number in word(Example: 9995 should be printed like "Nine Thousand Nine Hundred ninety five")
- JAI November 08, 2011 in India| Report Duplicate | Flag | PURGE
Turing Software Software Engineer / Developer Coding - 0of 0 votes
AnswerHow to prints all possible permutations of "TURING"?
- JAI November 08, 2011 in India| Report Duplicate | Flag | PURGE
Turing Software Software Engineer / Developer Coding - 0of 0 votes
Answerswrite a function that given two strings s1 and s2, it will return s1 Minus s2, and it has to use same s1 location.
- mirinda November 01, 2011 in India
ex: s1 = "abcdB" ,s2 = "b" ,s1 Minus s2 = "acdB"| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Coding - 0of 0 votes
AnswersFor example, give the letter (p,o) and length of 3, produce the following output(in any order you want, not just my example order)
- kap October 28, 2011 in India
ppp ppo poo pop opp opo oop ooo
another example would be given (a,b) and length 2
answer: ab aa bb ba| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 1of 1 vote
AnswersSuppose there is a circle. You have five points on that circle. Each
- aniketnit October 24, 2011 in India
point corresponds to a petrol pump. You are given two sets of data.
1. The amount of petrol that petrol pump will give.
2. Distance from that petrol pump tp the next petrol pump.
(Assume for 1 lit Petrol the truck will go 1 km)
Now calculate the first point from where a truck will be able to
complete the circle.
(The truck will stop at each petrol pump and it has infinite
capacity).
Give o(n) solution. You may use o(n) extra space.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a function to check valid parenthesis.
- msramachandran October 20, 2011 in India
(()) - valid
)( - invalid.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven an array like below, construct a N-ary tree from it.
322100100
each number represents the number of children starting with root.
- msramachandran October 20, 2011 in India3 / | \ 2 1 0 / \ \ 2 0 0 / \ 1 0
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a function to check if a binary tree is a binary search tree.
- msramachandran October 20, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven two version numbers as string (can be very long) write a function which returns 1 if first one is latest, -1 if second one is latest and 0 if they are equal.
- sasi.baratams October 17, 2011 in India
Ex: 1.2.0.4.5
1.2.1
We have write our split method with period as delimeter and we have to handle all the malformed version numbers like 1..2.0 etc and similar other exceptions| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven a string, we have to find all the unique words present in the string. Assume that words are delimited by space character and we have to write our own split function. We have to handle all the edge cases
- sasi.baratams October 17, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersConvert the integer in to string representation of the int value. Example : Like 41 = Forty one, 441 = Fore hundred Forty One , 3441 = Three thousand Fore hundred Forty One....
- amitnagar21 October 17, 2011 in India| Report Duplicate | Flag | PURGE
Future Group, Mumbai Software Engineer / Developer Coding - 0of 0 votes
AnswersFind the maximum continuous sum in an array. The array will contain at least one positive integer. Report the actual sequence. If there are multiple sequences report any one.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Arrays Coding - 0of 0 votes
AnswersClassic 2 Sum Question.
- Deleted September 19, 2011 in United States for Amazon.com| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersYou are given a string sequence and program need to output the number of times consecutive character sequences happen for increasing sequence length. eg. aabbababbd has 2 sequences as a followed by a, b followed by b. The for sequence length 2, ab followed by ab at 5th position. This is to be coded in minimum complexity.
- nitatbit September 18, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Coding - 0of 0 votes
Answersdifference between equalto and == in java
- cliffs007 September 12, 2011 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
Answersconstruct a BST given its preorder traversal..No extra space allowed
- dev September 03, 2011| Report Duplicate | Flag | PURGE
Coding - 0of 0 votes
AnswersGiven two lists, each containing numbers, how would you find the intersection of these two lists? What if these two lists are read from a huge file that cannot fit in memory?
- Anonymous August 27, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersImplement a function that performs binary addition. Input to the function is two const strings. The function returns a string that holds the result of addition.
- Jobseeker August 24, 2011
char* binaryadd(const char* a, const char* b) { }
Eg. "1001"+"101"="1110"| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Bit Manipulation C Coding String Manipulation - 0of 0 votes
AnswersWrite a function to check if the two strings given are anagrams are not. here AAbCDE and DECbAA are anagrams.Also, ABC and BCA are anagrams. however, AABBC and CBBAA are not anagrams.
- djroxx August 20, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Coding - 0of 0 votes
AnswersFind two numbers(a and b) from integer array such that a + b = x, where x is input along with array. I have solution with o(n^2) with linear/brute force. But i was just wondering can we do it in n*log n or n or just log n.
- anonymous9 August 10, 2011
P.S. No range specified for numbers for array. We need very general solution| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding - 0of 0 votes
AnswersWritten: Q3:
- Abee July 20, 2011
Given a string, compress using run-length encoding.
Example:
Input: aaabbac
Output: a3b2ac| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
Answers(3rd phone interview)functions to print first n odd powers of 3, where n is given to the function:
- troy April 30, 2011void power(int n) { if(n<=0) throw IllegalArgumentexception else { for(i=1;i<n;i++) int result = Math.pow(3, 2i-1); System.out.println(result); } }
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
Answerquestion on analyzing a piece of code and then asked about what can go wrong in this code like what exceptions can occur/what the code is doing.The question was extended to involve issues related to threads.
- Anonymous April 28, 2011| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite an algorithm to check if an array holds a string value that you are passing in
- ckeerthy April 28, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Algorithm Arrays Coding - 0of 0 votes
AnswersThere is a recursive function f(). It is looking at “cond” and then either returning or executing f() then g(). Consider “cond” to be an external variable that can be set somewhere else, perhaps in a different thread.
- tBag April 08, 2011
(1) If the first five times cond is checked, cond is == to true, but the sixth time, cond is == to false, describe the code flow.
(2) Because this is recursive, the code could suffer from a stack overflow if “cond” is == to true for too long. Fill in the function iterative_f() so that the code flow is identical to the code flow in (1).
//recursive
void f()
{
if(cond == false)
return;
f();
g();
}
//iterative
void iterative_f() {
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding