Coding Interview Questions
- 0of 0 votes
AnswersWhat does this code do?
- xyz September 12, 2008
int *p=0;
double *q=0;
printf("%u %u",p,q);
p++;
q++;
printf("%u %u",p,q);| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Coding - 0of 0 votes
AnswersCode for replacing multiple spacing by single spacing in a string...
- xyz September 12, 2008
e.g. " a b c d" --> " a b c d".| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Coding - 0of 0 votes
AnswersReverse the link list. Write a code and dictate it. Write two approaches: recursive and non-recursive
- Xenith September 06, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Linked Lists - 5of 0 votes
Answersfind max number of repetitions in an array.like {2,3,4,5,2,3,2} max repeat is 2. optimize it for space then in time.
- newguy September 01, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding - 0of 0 votes
Answersfunction to give mask for first 2 non zero (anything except 00) values in int.
- newguy September 01, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Coding - 0of 0 votes
Answersreverse binary representation of number.
- newguy September 01, 2008| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Computer Architecture & Low Level Coding - 0of 0 votes
AnswersCheck if there is a common node in 2 linked lists.
- sriram.s September 01, 2008| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersWrite code in any language to check if a string is a palindrome
- Gayle L McDowell September 01, 2008| Report Duplicate | Flag | PURGE
CapitalIQ Software Engineer / Developer Coding - 0of 0 votes
AnswersWhen asked to code fibonacci, I asked iteratively or recursively? He asked what's the trade-off between the two? Then I coded both. He said, there's a bug in your iterative solution. I looked and it and said, int's can be negative. He said, bingo. Then I said, "but I made a precondition that the input is positive." He was like, oh okay and how would you check the condition? I said partitioned equivalence testing for <0,==0,>0.
- Jack September 01, 2008| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 0of 0 votes
AnswersCreate a balanced binary tree from a given link list
- xmagics August 31, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 1of 0 votes
AnswersDesign a function to find whether a given tree is a mirror of another other tree.
- xmagics August 31, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersThis question was asked at a career fair. There is a string where each and every word is separated by one or more spaces. The string has to be modified in such a way that half of the spaces are put in the first half and the other half of the spaces in the next half with the characters in between. For example, if my initial string is "This is test"(there are totally four spaces), then the output should be
- noviceprog August 31, 2008
" thisisatest ".| Report Duplicate | Flag | PURGE
Expedia Software Engineer / Developer Coding - 3of 0 votes
AnswersGiven an array of positive and negative numbers, find the maximum sum of any subsequence. Return both the sum and the subsequence.
- xmagics August 31, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 1of 0 votes
AnswersWrite code to reverse a single linked list
- Ronin August 25, 2008| Report Duplicate | Flag | PURGE
CapitalIQ Software Engineer / Developer Coding - 0of 0 votes
AnswersWhat will be the output of the following code for input values (2,2) and (3,3):
- bedazzled August 19, 2008
int fun(unsigned int m, unsigned int n)
{
if(m==0) return n+1;
if(n==0) return (fun(m-1,n+1));
return (fun(m-1,fun(m,n-1)));
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Coding - 0of 0 votes
AnswersImplement float returnAngle(int hour,int min) that tells you the angle between the hour and the minute hands on a clock.
- Retrun angle given hour and minute August 19, 2008
so basically at 2:00 the angle is 60deg, the function should return 60.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Math & Computation Coding - 0of 0 votes
AnswersWrite a function to add two numbers, without using any arithmetic operator. Even the ++ in for statement is not allowed
- Anonymous July 26, 2008| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersWrite function similar to malloc.
- Anonymous July 26, 2008
void* myMalloc(int n)
'n' is the num of bytes to allocate.
You are given a void* f pointer that points to the location free in the memory.| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer C Coding - 2of 0 votes
AnswersFibonacci Series: write a simple algorithm to find it. He first wanted me to write a recursive one.
- hipy16 July 22, 2008
What is the running time of this recursive one?
Can you write a better implementation? Its running time? Asked to code it in Java dictate the code.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite code to remove spaces from a string in-place
- lax July 22, 2008| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Coding - 0of 0 votes
AnswersWrite a function which reverses a singly linked list.
- MJ July 22, 2008| Report Duplicate | Flag | PURGE
Morgan Stanley Software Engineer / Developer Coding - 0of 0 votes
AnswersSwap two numbers without using a temporarily variable.
- mp July 22, 2008| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Coding - 0of 0 votes
AnswersDesign an algorithm and write code to find the common ancestor of two nodes in a tree
- mp July 22, 2008| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswerWhat is linked list? Write code to detect a loop in a single linked list.
- moovgoar July 22, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Linked Lists - 2of 0 votes
AnswersWrite a function: you have an array, which consists of some number which are duplicated 2n times, only one number is duplicated 2n+1 times. Your input parameters are the array and the length of the array. Output the number which is duplicated 2n+1 times. I initially told about XOR, but he then told me XOR is not allowed.
- armisho July 22, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersYou have a stream of lines in a text file. How would you randomly pick one line?
- armisho July 22, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 0of 0 votes
AnswersWrite a function to reverse a line (i.e "How are you" will become "you are How")
- himanshu July 22, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm - 1of 0 votes
AnswersHow to delete the kth element from the end of a linked list?
- himanshu July 22, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding Algorithm Linked Lists - 0of 0 votes
AnswersWhat's the difference between const pointer and pointer to const.
- Sach (Sachin) July 22, 2008| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer Coding Terminology & Trivia