Amazon Interview Question for Software Engineer / Developers






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

One possible solution can be WBBWWWB with the most optimised approach.
Please validate, if posible...

Cheers!!

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

paint like BWBWWBWWWB ......

how to generate two or more W ???
Sol : After painting by W leave some space without paint. Again paint with W.

- Toxic August 27, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think this solution is correct.

Is there any other solution?

- Kiran September 13, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Consider 8 sectors on the disk. Paint 4 consecutive sectors with one paint, say White. Then paint one adjacent sector with Black paint. Then the next adjacent sector to this one with White paint and the remaining two sectors with Black paint.

So the disk now looks like ....W W W W B W B B... in a circular fashion.

Once you can see a sequence having 4 consecutive whites, you can tell which direction the disk is spinning.

After 4 whites, if you get one black and then one white, it is spinning in the clockwise direction.

After 4 whites, if you get 2 blacks and one white, it is spinning in the anti-clockwise direction.

- VP August 27, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Oops ! I have correction in the last two lines in my answer:
So the disk now looks like ....W W W W B W B B... in a circular clockwise fashion.

I meant After 4 whites, if you get one black and then one white, it is spinning in the ANTI-clockwise direction.

After 4 whites, if you get 2 blacks and one white, it is spinning in the Clockwise direction.

- Anonymous August 27, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I dont know but I assume to color an arrow like structure having a tail and a head. Color the head ">" in black and tail ">" in white. Now while the CD is revolving, if the tail follows head its Clockwise and if Head follows Tail its anti-clockwise.

- ck September 06, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

changing the icons like Head will be like a tilted triangle and tail like an greater than sign ">"

- ck September 06, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

hi ck
m sorry .... i think your answer is not correct because how would a sensor come to know whether color sign is > or <. sensor would give just give output same in both the cases.
VP's answer would work definitely.

- vikas September 08, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I've verified that WWBBBWBW is one of the correct answer.
If we use binary, the equivalent question is:
" find an eight digital binary string where the circular left shift and the circular left shift for the inverse string are different."

This brings me to think:
" Is there an invariant while doing the left shifting? (no matter how we do circular left shift on this string, we can apply some logical operation to that binary string and get an invariant) while inverting that string changes this invariant? "

- mathena September 10, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I have another idea to add

you can have painting pattern like this.
B W B&W
the last one is the mix of black and white.Even if the sensor cant sense that color,the direction can be found.
If clock wise B W _ B W _
if anti clock wise W B _ W B _
Is this ok?

- ram October 08, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assign uniques codes to clockwise and counter-clockwise. Whichever one appears will indicate direction of spin.

This problem is analogous to finding Endianess.

- Jack December 13, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I got this question in cisco....

paint with white and black each color is painted only once...

say u split the cd into 8 sectors.... pain the first sector white and second sector black...
if it is rotating clockwise... u will see the white first and then black... if it is anticlockwise... u will see black with an interval of 6 sectors and then u will see white...
I know i have not explained my solution clearly.. but i guess u guys are intelligent enough to understand.

- Anonymous March 12, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yeah, we are intelligent enough to understand how dumb you are!

- Dumbo February 12, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

may be we can have a sequence like bwbwwbwwwbwwwwbwwwww.......
so if see W's increasing then we can have it as one direction
and if we see them decreasing then another direction

- Anonymous April 13, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

IMHO VPs answer is the best one and simple to understand as well...thanx vp..

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

Blanks are unnecessary. I found that the easiest way is to paint it as BWBWWB.
If the sensor detect BWWBWB or BWBBWW, the CD runs the opposite direction.

- jobseeker November 01, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i think this is the simplest solution...

- jobgiver July 17, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

hey you two guys rock buddy...awesome answers..
jobseeker and jobgiver, both of you are selected for the position of SE@Amazon,NY...just mail me your bio : katherine.ny@amazone.com

- fromAmazon July 17, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

paint B at any place paint R 90 deegre from B(behind B), place the sensor digonaly opposit of cd, black sensor should be on top of B,
let say t time for one complet circule if Red sensor will be recived a match in 3t/4 then clockwise else counter clockwise

- arun November 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

could this be a possible solution (assuming it is necessary to paint entire cd with paint so as to
function as a protective coating of some sort ):-
8 sectors:
BWBBWBBBWBWBBWBBBW
becomes BBWBWBBBWBBWBWBBBW IN THE OTHER DIRN.
PLS REPLY AS IM IN MY 2ND YEAR AND NEED PRACTISE.

- amez April 08, 2013 | 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