Adobe Interview Question for Software Engineer / Developers






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

The cost of each cut is determined by the longer piece in last cut. For example,1st cost is always 15. 1st cut at 9, then the next cut cost is 9(9-0>15-9). 2nd cut at 5, the next cost is 5. So each time choose the point which is nearest to the middle point.

- Nnn January 18, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Each time, chosing median point is the right answer.

- Anonymous January 22, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Nope median(greedy strategy) does not work. You will have to use Dynamic Programming

- jill December 01, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

yup.. this is basically a variant of optimal matrix chain multiplication .. the cuts being the points to parenthesize..

- aditya April 26, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

a dp solution could be :
let the log cuts to be made be L[1],L[2],...,L[k] s.t. L[1]<L[2]<...<L[k]<L.

1. set L[0]=0 and L[k+1]=L
2. let c[i][j] be the min cost to completely cut a log of wood that starts at groove i and end at groove j, then we need to find a groove between i and j, say m such that after cutting at m we have two logs which are minimum in terms of their cost themselves. also note that j>i+1 for a 1 length cannot be cut and hence if j<=i+1 c[i][j] should be 0 for it.

thus ,
c[i][j] = ((L[j]-L[i]) + min(c[i][m] + c[m][j]) for all i<m<j and j>i+1)
and 0 otherwise.

create a top-down recursive function and the min cost shall get saved at c[0][k+1]. The order can be found by storing the value of m at each c[i][j].

this is a O(n^3) solution.

- Anonymous March 13, 2011 | 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