Interview Question for Software Engineer / Developers






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

93...

- anonymous... October 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

How?

- chenna October 27, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I dont get it...
Zombies cannot move directly from 1st lane to purchase lane? the initial condition is "The zombies are standing in the first waiting lane (ordered 1st to 10th)" why not just move one by one to the purchase lane or next lane? i think it definitely not the correct answer. did i miss anything here?

- Anonymous October 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

okay. added more info to the question.
You can only move zombie's from the front of the lane, the back of the lanes are closed. So if you move zombie3 to purchase lane then only zombies 1&2 can be moved to that lane because any other zombie greater than 3 cannot stand in front of zombie3.
Think of the lanes as a stack.

- chennavarri October 27, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

hanoi tower?

- Anonymous October 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Actually, Reve's

- Anonymous October 28, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

i am gonna give a wild guess here.
move 3~10 from 1st to 2nd lane. it takes 255 steps : sum(n)=sum(n-1)*2+1
move 1 and 2 from 1st lane to purchase lane in order : 3 steps.
move 5~10 from 2nd to 1st lane. it takes 63 steps
move 3 and 4 from 2nd lane to purchase lane in order: 3 steps.
move 7~10 from 1st lane to 2nd lane. it takes 15 steps.
move 5 and 6 from 1st lane to purchase lane in order: 3 stpes.
move 9~10 from 2nd to 1st lane. it takes 3 steps.
move 7 and 8 from 2nd lane to purchase lane in order: 3 stpes.
finally move 9 and 10 to purchase lane in order: 3 steps.

So, the total would be 351 steps.

- Anonymous October 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Optimal number of moves for moving 10000 zombies from one lane to another lane in a 4-lane problem is :: 374931278650296101567069263458900577819295744

Optimal number of moves for moving 1000000 discs from one stack to another stack in a 1000-peg problem is :: 6000001.00

- Anonymous October 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Optimal number of moves for moving 31 discs from one stack to another stack in a 4-peg problem is :: 1153.00

ANSWER:
Optimal number of moves for moving 10 from one stack to another stack in a 4-peg problem is :: 49

- Anonymous October 28, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

93 is the answer.

Aussme f(n) is the steps that we need, then
f(1) = 1
f(2) = 3
When n > 2
f(n) = f(n-2) + 1 + 1 + 1 + f(n-2) = 2*f(n-2) + 3
Ex:
When we need to move 10 zombies,
we can use f(8) steps to move zombie 1st to 8th to a waiting lane, then 1s tep to move zombie 9th to the another empty wating lane(it must be empty), after that 1 step move zombie 10th to purchase lane, 1 step to move zombie 9th to purchase lane, at last, f(n-2) steps to move 1st to 8th to purchase lane.

- Fisher October 29, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

93 is the answer.

Aussme f(n) is the steps that we need, then
f(1) = 1
f(2) = 3
When n > 2
f(n) = f(n-2) + 1 + 1 + 1 + f(n-2) = 2*f(n-2) + 3
Ex:
When we need to move 10 zombies,
we can use f(8) steps to move zombie 1st to 8th to a waiting lane, then 1s tep to move zombie 9th to the another empty wating lane(it must be empty), after that 1 step move zombie 10th to purchase lane, 1 step to move zombie 9th to purchase lane, at last, f(n-2) steps to move 1st to 8th to purchase lane.

- Fisher October 29, 2010 | Flag Reply


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