Interview Question


Country: India




Comment hidden because of low score. Click to expand.
0
of 0 vote

Which company?

- Anonymous September 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Adobe

- Anonymous September 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

1 6 8
2 8 4
1 6 8

- -Lucy September 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

after running the code ; answer is :
1 6 8
2 8 4
1 4 10
3 4 5
1 9 5
2 5 7
1 7 7
@lucy : can u explain plz...

- Anonymous September 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@anonymous--Create a tree like structure
crazy(3,4,5)
/ \
crazy(2,8,4) crazy(2,5,7)
/ \ / \ crazy(1,6,8) crazy(1,4,10) crazy(1,9,5) crazy(1,5,7)

After this u will get zeros in crazy(0 , -, -).So now how will u print it i,e in what manner.after crazy (1,6,8) wil be called it return becoz .n=0 so prints it.Think like inorder..
U will print first 1 6 8 den move to the called function
print 2 8 4 den 1 4 10 den move upwards..den root one 3 4 5 den similiarly in right subtree 1 9 5
2 5 7
1 7 7

- -Lucy September 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@ Lucy : great explanation ...!!!

- Anonymous September 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Code is in the pattern similar to inorder traversal of a binary tree.Can use the same funda here as Lucy explained...:)

- jinu September 16, 2012 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More