P
BAN USER- 0of 0 votes
AnswersConsider a cloak room. It has 3 compartments, small, medium, large
- P in India
1 medium = 2 small
1 large = 2 medium = 4 small
Design such a system, ensuring maximum capacity optimization of the compartments. Also, make the required number of moves (in-btw compartments) as minimum as possible.
Write class, functions. Wht functions will u expose. What token will you return back to the user.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Application / UI Design - 0of 0 votes
AnswersGiven pre order traversal of a tree. It has only 2 type of nodes, N & L (non-leaf, leaf).. Also, every node either has zero or two children.
- P in India
Produce the tree.
Eg: Pre-order NNLLL
Tree;
N
/ \
N L
/ \
L L| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersGenerate all the possible substrings using the characters of a given string. Write code. (The order of chars do not matter, i.e., ac <=> ca)
- P in India
i/p: abc
o/p: { a,b,c,ab,ac,bc,abc}
<Modified the language of the question, to avoid any confusions>| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a set of strings (large set), and an input string, you need to find all the anagrams of the input string efficiently. What data structure will u use. And using tht, how will u find the anagrams.
- P in India for Bing| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 1of 1 vote
AnswersGiven an array of 0's and 1's, and a number k, find the minimum window that contains k 0's. Write code.
- P in India for Bing
Extension, now the array contains integers from 0 .. 9 ... and another input array of size 10 is given, that contains the number of occurances of a digit. Find the min window that contains the given no of occurance for each digit.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersCOnsider the column names given in microsoft excel. A .. Z, AA ... Az, BA .... BZ, .......... ZZ, AAA, ..... and so on.
- P in India for Bing
Given a column name (string of charectors), find the corresponding number.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - -1of 1 vote
AnswersGiven an integer, and a number k, do a cyclic shift (left / right) by k bits of the number.
- P in India for Bing| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersDesign an online movie booking system
- P in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersGiven the number, find the immediate next (larger) palindrome
- P in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 2of 2 votes
AnswersDesign a data structure where the following 3 functions are optimised:
- P in India
1. Insert(n)
2. GetRandomElement()
3. Remove(n)
Write a class, and implement the functions. Give complexity of each of these ..| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Application / UI Design
This is one way of doing this ..
- P October 31, 2011template < typename X1 >
struct Foo;
template < template < int, int > class X, int A, int B>
struct Foo< X<A, B> > {
void foo() {
printf("ok, %d, %d \n", A, B);
}};
template < int X, int Y >
class Param {
int x,y;
public:
Param(){x=X; y=Y;}
void printParam(){
cout<<x<<" "<<y<<"\n";
}
};
int main() {
Param<10, 20> p;
p.printParam();
Foo< Param<10, 20> > a;
a.foo();
return 0;
}