Yahoo Interview Question for Software Engineer / Developers






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

I think
BWBBWW should be the order...

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

absolutely correct!

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

Can you please explain how you arrived at this decision??
The question itself is not very clear to me. Help appreciated.

- Unknown June 09, 2012 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

maza a gya!!! me gavar hu.. hahahaha....

- chuddu July 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

answer is need of 6 sectors
b
w
b b
w
w

- cs1rangers September 12, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

6 sections with B W B B W W colors

- ravi September 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

^ - Stupidity has its limit

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

i cant see why the answer is stupid? The sensor can read and output. So the rotation direction can be identified by output BW or WB.

Am i missing something?

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

The reading point of the disc would not be the same everytime...hence ur ans would not work..

- Papa September 21, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

can't it be BWBWW . Correct me if i'm wrong

- afs.abhishek October 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

ABSOLutely wrong.....

BWBWW
WBWWB
BWWBW
WWBWB
WBWBW
all sequences can be produced in both ways.

- Mridul Malpani October 20, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

How many sensors are allowed? With 2 sensors, only2 sectors are required. Microsoft asked this question, (on campus) and presented a similar situation.

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

BWWBBB

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

WBBBWBBWB

- anilkumarkatti January 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Problem with BWWBBB:

BWWBBB can be produced both clockwise and anticlockwise. Start from 4th B and go right to left.

- anilkumarkatti January 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

What if we have a white, a blank sector and then a black sector, rest all being blank

- Sameer March 24, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Just paint different patterns. U got 2 colours... solid black, solid white, "grey", black and white (patterns)

- wei sheng April 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

dudes......
y u ppls r taking so many risks???
just think a cd can rotate in only one direction in cd drive...

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

/// Assume Result is : a1a2a3...an 
/// Satisfy the condition: a1a2a3...an , a2a3a4....ana1, ...., ana1a2....an-1 Not Match Any 
/// anan-1...a1, ..., a1anan-1...a2
/// Using BruteForce 
int shift(int m[], int n)
{
    int t = m[0];
    for(int i = 0; i < n - 1; i ++) m[i] = m[i + 1];
    m[n - 1] = t;
    return 0;
}
bool equal_arr(int a[], int b[], int n)
{
    int i = 0;
    for(i = 0; i < n; i ++) if(a[i] != b[i]) break;
    return (i == n);
}
bool is_match(int a[], int b[], int n)
{
    bool ok = true;
    for(int i = 0; i < n; i ++) 
    {   
        shift(a, n); 
        for(int j = 0; j < n; j ++) 
        {   
            shift(b, n); 
            if(equal_arr(a, b, n)) {ok = false; break;}
        }   
        if(!ok) break;
    }   
    return ok;
}

int gen_arr(int a[], int x)
{
    for(int i = 0; i < 32; i ++)
    {
        a[i] = (x & (1 << i)) ? 1 : 0;
    }

    return 0;
}
int run()
{
    int a[100], b[100];
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    int N = 3;
    bool ok = false;
    while(1)
    {
        if(N > 100) break;
        int x = (1 << N) - 1;
        for(int i = 0; i <= x; i ++)
        {
            gen_arr(a, i);
            for(int j = 0; j < N; j ++) b[j] = a[N - j - 1];
            if(is_match(a, b, N)) {
                ok = true; break;
            }
            if(ok) break;
        }
        if(ok) break;
        N ++;
    }
    for(int i = 0; i < N; i ++) {
        printf("%c ", a[i] ? 'B' : 'W');
    }
    printf("\n");
    return 0;
}

- zombie June 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the sector can be painted in order -- W B W W B B

- koolkeshaw July 14, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

y cant i just paint BW ?
If the output is BW then its clockwise , otherwise the output will be WB

- Anonymous September 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

There is no way we can identify it from output only.

- Amit Priyadarshi September 24, 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