Coding Interview Questions
- 0of 0 votes
AnswersGiven an unsorted array, how to divide them into two equal arrays whose sum of difference is minimum.
- Psycho September 29, 2012 in United States
Can it be done in o(n)?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Morgan Stanley Java Developer Coding - 0of 0 votes
Answershow would you print the lever order of a tree (not a binary tree i.e. each node has more than two children)?
- MobileEdge September 27, 2012 in United States| Report Duplicate | Flag | PURGE
Algorithm C++ Coding Data Structures - 0of 0 votes
AnswersImplement a console based palindrome game where the input follows a sting and optionally followed by player's name.
- kk September 26, 2012 in India
Rules
-----
1. If the player enters a valid palindrome then increase the score by half the palindrome's length.
2. The game also lists top 5 Hall-of-Fame players based on the score ranks.
3. The game should register the player if not already registered.
4. If the server resets - then the players score should be reset to zero.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Coding - 0of 0 votes
AnswersWrite an API to find valid IP address.
- anvijain September 23, 2012 in United States for Windows Azure
(Asked followup questions like which kind or IP format, return type, range specific, etc.)| Report Duplicate | Flag | PURGE
Microsoft Program Manager Coding - 0of 0 votes
AnswersThe aim is to find the optimal solution which packs the pieces in 4x4 unit square.
- jaipster September 14, 2012 in India for SDE
a jig saw puzzle is made up of exactly 4 pieces.
size of the completed puzzle is always 4 units x 4 units. This is given
There is no picture printed on the pieces; any solution would be valid, as long it is a 4 x 4 unit square.
The pieces can be only triangles, or quadrilaterals. Nothing else.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm Brain Teasers Coding Dynamic Programming - 0of 0 votes
AnswersGiven a log file, extract all the lines starting with the word ERROR.
- sam August 28, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersA string s is said to be unique if no two characters of s are same.
- swati.2332 August 19, 2012 in India
A string s1 is producible from s2 by removing some of the characters from s2.
A string s1 is said to be more beautiful than s2 if length of s1 is more than s2 or if both have same length and s1 is lexicographically greater than s2( ex: ba is more beautiful than ab)
Input: is a string which can be of maximum 10^6 characters, you have to produce the most beautiful unique string out of the given string.| Report Duplicate | Flag | PURGE
Facebook Coding - 0of 0 votes
AnswersN*N matrix. contains only 0's and 1's.
- kb August 13, 2012 in India
every row is sorted in descending order.
find row containing maximum no of 1's. Efficient soln reqd.| Report Duplicate | Flag | PURGE
Adobe Amazon Algorithm Coding - 0of 0 votes
AnswersThis is a newbie interview question from Statistic industry.
- Xiaonb August 13, 2012 in CHINA
there are a vector v {c1, c2,c3...c(n-1)} and a variable x, try to construct a polynomial eg:
p(x)= c1 + c2*x + c3*x^2 + ... + c(n-1)*x^(n-1)| Report Duplicate | Flag | PURGE
Coding Java - 0of 0 votes
AnswersGiven a line, adjust this line to the page width.
- jiangok2006 August 10, 2012 in United States
For example, given "Dog is cute" (length of chars is 11) and the page width is 15, adjust the line to "Dog is cute". The extra spaces should be distributed as much even as possible. Assume there is no space before the first word or after the last word.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - -2of 2 votes
Answersif an array is given like 11
- Tester August 09, 2012 in United States
increment its value to 1
o\p should be 12
if the array has 99
o\p should be 100
you can use vectors.| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Coding - -2of 4 votes
Answersgiven input
- Tester August 09, 2012 in United States
i\p : [1,2] [2,3] [3,4]
i\p: 2,3
o\p should be: [1,2] [2,4]| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Coding - 1of 1 vote
Answersgiven an array of integers generate out put using product of N-1.
- Tester August 09, 2012 in United States
eg: if input is 1,2,3,4
output will be each product of other int in the array : eg: 2*3*4 , 1*3*4 ,1*2*4 , 1*2*3
solve in N not in N2 algo.| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Coding - 0of 0 votes
Answersgiven an array of sorted integers with duplicate values , sort the array so that there are only unique values left in sorted order ( do not use any additional data type , do inplace sort )
- Tester August 09, 2012 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Coding - 0of 0 votes
AnswersGiven a list of strings & string M28K, where M28K represents a string which starts from M , ends with K and has 28chars in between . Find if M28K is unique in the list of strings or not?
- Tester August 09, 2012 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer in Test Coding - 0of 0 votes
AnswersWrite a function that would return the 5th element from the tail (or end) of a singly linked list of integers, in one pass, and then provide a set of test cases against that function (please do not use any list manipulation functions that you do not implement yourself).
- tani August 08, 2012| Report Duplicate | Flag | PURGE
Linkedin Software Engineer / Developer Coding - 0of 0 votes
AnswersIf A and B, two integers are given.
- Sanjay Kumar August 08, 2012 in India
compute A/B.
Ex. 2/5 --> Ans should be 0.4
225/1000 --> Ans should be 0.225
22/7 --> Ans Should be 3.(142857) where 142857 are repeating decimal| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 0of 0 votes
AnswersFind the longest
- grave August 05, 2012 in India
subarray which consists of numbers that can be arranged in a continuous sequence.
For ex- {4,5,1,5,7,6,8,4,1}
output-{5,7,6,8,4}.Find the longest.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding - 0of 0 votes
AnswersPrint all combinations of M members of a set of N elements in a sequence such that each set can be obtained from the previous set by deleting one member and adding one member.
- grave August 03, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding - 0of 0 votes
AnswersThe two nodes in BST are swapped.Correct the BST.
- amnesiac July 28, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Coding - 0of 0 votes
Answerswrite a program to replace 0 with 5 in an array given??
- padmamadala17 July 26, 2012 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Coding - 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 2 votes
AnswersGiven API:
- jiangok2006 July 26, 2012 in United States
int Read4096(char* buf);
It reads data from a file and records the position so that the next time when it is called it read the next 4k chars (or the rest of the file, whichever is smaller) from the file.
The return is the number of chars read.
Todo: Use above API to Implement API
"int Read(char* buf, int n)" which reads any number of chars from the file.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Coding - 0of 0 votes
Answerswrite a program to search by name or phone number(mobile or PNT) in database(phonebook,directory..etc. ) for e.g query 'ry'
- Just_Neel July 24, 2012 in -
its should display the all possible name which contain these word or letters .arya,surya,Marya,tarry,marry....etc.
some for phone numbers.....| Report Duplicate | Flag | PURGE
Coding - 0of 0 votes
Answersinput a text and a pattern. The pattern can have *, say a*b, a**b, *ab... find whether the pattern matches the whole input text.
- jiangok2006 July 20, 2012 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Coding - 0of 0 votes
AnswersInput:
- Nikhita July 18, 2012 in India
3
3 1 2
nny
nnn
ynn
output:
2 1 3
n size of permutation P.First line of input is n.Second line is the permutation P.A Permutation X is said to be lexicographically smaller than Y if for all digits till i X[i]=Y[i] and for i+1 X[i]<=Y[i]so you can exchange the integers in the given permutation P if character j of line i+2 is 'y' then i th and j th integer in P can be exchanged .
Output:Lexicographically smallest premutation of the given P using rule| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Coding - 0of 0 votes
AnswerHow would you build a stock ticker service?
- sylarific July 17, 2012 in United States for Web Developer| Report Duplicate | Flag | PURGE
Front-end Software Engineer Coding - 0of 0 votes
AnswersTokenize the given string.
- grave July 16, 2012 in India for kindle
node* strtok(char* input ,char* delims)
Put the words seperated into the linked list and return the linked list.delims can be a single character or group of characters like "abc".
Dictate the code as you write.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Coding String Manipulation