Coding Interview Questions
- 0of 0 votes
AnswersToken a string on the basis if a given delimiter.
- Jack Sparrow August 09, 2006
e.g S is the base string and D is the delimiter (could be a sequence of any valid chars)
S = ["who is the man who saw the eagle today went the wrong way?"]
D = ["the"]
Result = ["who is ", " man who saw ", " eagle today went ", " wrong way?"]| Report Duplicate | Flag | PURGE
Microsoft Coding - 0of 0 votes
AnswersWrite a function that returns a running average everytime it get called. Make provisions for multiple processes to call this function.
- Jack Sparrow August 09, 2006| Report Duplicate | Flag | PURGE
Microsoft Coding - 0of 0 votes
AnswersWrite code to reverse a doubly linked list
- XXXX July 31, 2006| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer Coding - 0of 0 votes
AnswersCount the number of set bits in a byte
- Philip July 24, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersRemove duplicates from a sorted array
- Philip July 24, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite a program to calculate the nth Fibonacci number.
- Philip July 24, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite code to convert an IP address into a DWORD
- Philip July 24, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersHow will you merge two sorted arrays. The first array has enough empty spaces to accomodate the second array.
- Philip July 24, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersGiven a sorted array of n integers that has been rotated either to the left or to the right by i places, give an algorithm that searches and finds an element in the array in log n time.
- Philip July 24, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswerConvert the linked list you just created into array elements. Strangely enough, the interviewer insisted that a[10] does NOT create memory and "malloc" had to be mentioned, explicitly! (Not a happy outing here, again)
- Wildcat July 21, 2006| Report Duplicate | Flag | PURGE
Microsoft Coding - 1of 1 vote
AnswersGiven a binary tree where each node's value is a COLOR. A clump is formed when more than 3 COLORS are adjacent to each other. Return the total number of clumps in a binary tree.
- vodangkhoa July 17, 2006| Report Duplicate | Flag | PURGE
National Instruments Software Engineer / Developer Coding - 0of 0 votes
AnswerWrite a program to shuffle a deck of cards. Write your own random function. How will you make it more random? It's basically used in a casino, so it has to be AS RANDOM as possible. How can you make sure that no one sees your random function?
- XXXX July 14, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersWrite a program to find whether a machine is big endian or little endian
- XXXX July 14, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersGiven a binary search tree and a keyvalue, return the node that has value closest to the key.
- XXXX July 14, 2006| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersAsked to code the 'floodFill' method used by graphic products like Paint.
- MM June 29, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWhat is the benefit of using StringBuffer?
- Ankur Dhawan June 26, 2006| Report Duplicate | Flag | PURGE
Infosys Software Engineer / Developer Coding Terminology & Trivia - 0of 0 votes
AnswersAlgorithm and code to detect occurence of a string(patterns) in another string ex: aab, aababa
- Kiran June 12, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersHomework: Reverse all the words in a string.
- Little Bread June 08, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
Answersreverse linked list. Why don't you use recursion?
- N/A June 07, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design Coding Algorithm - 0of 0 votes
AnswerThe hardest question to date on a phone interview. he asked me to take 2 hours and write the following API.
- Muhariz Jabeer May 24, 2006
Create an LRU Cache that caches some key/value pair and kicks out the Least Recently Used when you run out of space. Wanted run times and asked me to comment on how good my implementation is and whether its good for industry level usage.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersAsked me to reverse a Linked list without re-creating a new one. I did it recursively going all the way to end and linking it backwards after the recursive call. Had to pass in two nodes though, one previous and one current. He said he likes iteration better becoz its more resource friendly :)
- Muhariz Jabeer May 24, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Linked Lists - 0of 0 votes
AnswersWrite a method to shufle the deck. The constraint is it has to be a perfect shuffle - in other words, every 52! permutations of the deck has to be equally like (given a completely random function which is theoretical of course).
- Muhariz Jabeer May 24, 2006
I managed to do this with a simple for loop in O(n) time
int[] deck = new int[52];
for(int i=0; i<52; i++)
deck[i] = i;
Random r = new Random();
for(int i=0; i<deck.length; i++) {
int ran = r.nextInt(deck.length-i) + i;
int temp = deck[i];
deck[i] = deck[ran];
deck[ran] = temp;
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersWrite simple state machine code in C
- NA May 23, 2006| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer Coding - 0of 0 votes
AnswersRemove a fixed character from a C-string
- NA May 23, 2006| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer Coding - 0of 0 votes
AnswersGiving Two Strings, Find out whether they are Anagrams or not?
- Altaf Al-Amin May 03, 2006| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Coding Algorithm