Interview Question

Intern Interview(Student Candidate)

There's an m x n array. A block in the array is denoted by

  a 1 and a 0 indicates no block. You are supposed to find the number of objects in the array. A object is nothing but a set of blocks that are connected horizontally and/or vertically. eg 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 There are 2 objects in this array. The L shape object and the object in the last row. I had seen this question before and was able to write the code for it. The question that followed was "Lets say you have multiple processors that can do the task parallely for you. How would you divide the task among these processors for the above problem"
Answer

Add Answers or Comments

To comment on this Review, Sign In with Facebook or Sign Up