| There is a blank disc( like a ... | |||||||
|
30 Day Risk-Free Guarantee:
100% money back if you're unsatisfied. Book (308 Pages):
![]() Video (One Hour):
![]() Resume Review (24 - 48hr)
All Products / Services
|
|||||||
There is a blank disc( like a CD). You are given two colors of paint (black and white) . A sensor can recognize the color painted on the disc and produce an output. Paint the disc in a way such that you can find the direction of rotation by looking at the output.
17
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.
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.
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.
changing the icons like Head will be like a tilted triangle and tail like an greater than sign ">"
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.
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? "
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?
Assign uniques codes to clockwise and counter-clockwise. Whichever one appears will indicate direction of spin.
This problem is analogous to finding Endianess.
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.
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
IMHO VPs answer is the best one and simple to understand as well...thanx vp..
One possible solution can be WBBWWWB with the most optimised approach.
Please validate, if posible...
Cheers!!
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.
i think this is the simplest solution...
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
paint like BWBWWBWWWB ......
how to generate two or more W ???
Sol : After painting by W leave some space without paint. Again paint with W.