## time

BAN USER- 2of 2 votes

Answersyou have given 2n+1 numbers in which 2n numbers are repeated means every number is having duplicate value.find that non repeating number in constant space and o(n) time.i told him using XOR.

- time in India

then he gave me 2n+2 numbers in which 2n numbers are repeating like above now you have 2 different number.find both number in constant space and o(n) time.(f2f 4th round)| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm - 0of 0 votes

Answersyou have given 3 task. you can run it using process or using thread. means 3 different process or combining them and run 3 different threads .which will you prefer and why?(f2f 4th round)

- time in India| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Operating System - 0of 0 votes

Answersyou have given 2n+1 numbers in which 2n numbers are repeated means every number is having duplicate value.find that non repeating number in constant space and o(n) time.i told him using XOR.

- time in India

then he gave me 2n+2 numbers in which 2n numbers are repeating like above now you have 2 different number.find both number in constant space and o(n) time.(f2f 4th round)| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm

i told him that if i will use process then at a time i will use one process when it will completed then i will swap with another process.lets assume that if one task is taking 4bytes memory then in this way i will able to complete my task in only 4 bytes. but if i use 3 threads within one process then i have to use 12 bytes . then he told me lets assume you have lot of space.then which you would prefer.

- time February 04, 2012@anon ..i think nice soln. if we count number of nodes or levels of leaf node,so we can check that if remaining number of nodes is less than compare to BST which we found till now. then there would not check further.

@anon i always saw your soln upto mark.. can i have you mail id.

i think raghu is saying correct.we have to modify stack the stack so that it gives min value in constant time.every time when we push the value in stack we have to check it is less than min value then simply push into stack

if not less than then pop min value from stack,push other value in it and then push min value on the top of stack.

at every time we will have min value in top of the stack, so we can get min value in constant time....

correct if i am wrong.

i think longest zigzag path would that path in binary tree.. = longest zigzag path in left subtree from root to leaf + longest zigzag path in right subtree from root to leaf.

which would be something like that =LRLRLRLRLR +RLRLRLRLRL

can any one tell me .. that this would be also zigzag path in tree like LLLRRLRLR

or LLLLLLLRRRRLLL or not.

hi akshay.shetye, i think the code will be like this because when you store it parent node it will update parent own value also.which could not recieved by grandparent. and i think it will update all node of tree with '0' value.

plz correct me if am wrong..

int sum(struct node* root)

{

if(root==null)return 0;

if(root->left==null) root->left->data=0; //correct me here if i am wrong

if(root->right==null) root->right->data=0;

root->data=root->left->data + root->right->data +sum(root->left)+sum(root->right);

return 0;

// i think every node of binary tree has been modified.

}

Rep**sharonpkarr**, None at BTHi! My name is Mary. I am a writer for a variety of web and multi-platform applications.I am a ...

Rep**carleywcote**, Problem Setter at BaiduI am a Photographer in Dallas. I Capture images as directed, taking all aspects into consideration, including outside lighting, shadows ...

Rep**JenniferSRoe**, Android test engineer at Accolite softwareI am Jennifer from Dublin. I am Photographer, I have experienced in all different kinds of photography -Strong aesthetic sense ...

Rep**davisjerryh**, Backend Developer at Abs india pvt. ltd.For the last two years, I am Effectively managing the teamâ€™s performance, conducting regular performance reviews and appraisals, and ...

Rep**lonnacribbs**, DIGITAL MARKETING at Athena HealthI am a Market Research Manager responsible for selecting the appropriate research methodology and supporting techniques to meet a defined ...

Rep**angelwilley8**, xyz at Asiatic SolutionsI am Angel J. Willey from Gurnee. I am working as a truck driver in Asiatic Solutions company. I also ...

Rep**carlaapepin**, Area Sales Manager at AtmelHello, I am Carla and I live in San Bernardino, USA. I am working as a bookkeeper in a library ...

Rep**PriscillaRYoung**, Aghori Mahakal Tantrik at Absolute Softech LtdHi, I am Priscilla from California. I am working as a Business management consultant in Quality Merchant Services company. I ...

RepI am from london. I am 27 year old. I work in a balanced fortune as a personal care aide ...

Rep**victorcraigw**, Animator at Chicago Mercantile ExchangeHi, I am Victor working as a Speech Writer in the USA. Spoke at an academic conference about mantra for ...

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

hey can you explain your code more. you have taken different function where it is using not getting your point

- time February 05, 2012