Adobe Interview Question for Software Engineer / Developers






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

apply quick sort technique, here compare function will be comparing NUT with Bolt.

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

Could you please elaborate?

- A May 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

its like select any random bolt and for try with each nut. Now u will know all the nuts which are larger than this and smaller than this. this bolt will be like pivot and again you would have two search domains. again sort these domains like quick sort.

- neo May 25, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

wont work...this is because u wont know if the next nut u pick wud be smaller than previous or not....so again u have to search the whole set of remaining bolts

- utscool June 17, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

srry.... on second thought i got it...actually correcting ur lines the solution is:
its like select any random bolt and for try with each nut. Now u will know all the nuts which are larger than this and smaller than this. NOW WHEN YOU PICK NEXT BOLT THE NUT FOUND OUT IN FIRST (AND NOT THE BOLT) will be like pivot and again you would have two search domains. again sort these domains like quick sort.

- utscool June 17, 2010 | Flag
Comment hidden because of low score. Click to expand.
1
of 3 vote

Each bolt will have its matching nut.
Now, say first time, when you choose a bolt and try to match its nut with each of available nuts. Here, if choosen nut is smaller to fit the bolt, put it in left side else put it in right side. Finally, in first pass, you will have a matching nut-bolt and some nuts on left(smaller than matching nut) and some nuts on right(bigger than matching nut).
So, for second bolt, try the bolt with previous matched nut, if it is smaller, then you need to search only right side collected nuts. And if it is bigger in size, then you need to search only left side collected nuts.
This way.. You will have a search to logN steps. First pass took N.
So, O(NlogN)

- Suresh Paldia January 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

is there a way we can sort the bolts?..if yes,sort the bolts and binary search the matching one for each nut..this is a silly solution though..lol

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

wisdom.weizmann.ac.il/~naor/PUZZLES/nuts_solution.html

- erappy July 02, 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