An array of integer is given , both +ve and -ve. Find two elements whose sum is closest to zero.
Friday, December 13, 2013
Thursday, December 12, 2013
Microsoft] Print last 10 lines
Given some text lines in a string, each line is separated by '\n' characters. print the last 10 lines. If no of lines is less than 10 , then print all the lines.
Deepest left leaf mode in a binary tree
Given a binary tree, find the deepest leaf node which is left child of its parent.
[Fab.com] Find the celebrity
Given a function know(A,B) which returns true if A knows B , otherwise false. Now there is one celebrity who is known to everyone and who does not know anyone. Given an array , find the celebrity in less than linear time.
[Amazon] Find an element in array whose element differ by 1
Given an array in which two elements differ by +1 or -1. Find an element k in such an array in less than linear time.
Wednesday, December 11, 2013
[Fab.com] Design a car parking lot.
Design a car parking lot. Tell about all the classes and functions. It should be able to say full, empty, normal.
The lot has 3 different kind of parking : regular, handicapped and compact.
The lot has 3 different kind of parking : regular, handicapped and compact.
Subscribe to:
Posts (Atom)