Wednesday, 19 September 2012

AMAZON CODING ROUND 2011


coding questions amazon 2011
They gave to us (NIT CALICUT) this year
here are the coding ques...

1) if there is a singly linked list the we should reverse the list
upto a certain number passed in agrument.

eg..

Node * reverse_upto_num(Node* head, int k)
is the function.. we had to complete it... such tht first K elements
should get reversed.

this is the sample they gave us
1>2->3->4->5    is the list then for k=3.. output should be
3->2->1->5->4


2) for a string we should be able to find all possible permutations of
characters of certain length passed through the function as argument
in lexicographic order.

Permute_string( string, int k)
{
}
eg. if string is :  AS  and k=2
 then function should give  following as output.

aa
as
sa
ss

----------------

No comments:

Post a Comment