can u all help me with a question.
I have been given two boolean 2d square arrays. 1st array is one having random true or false values.
2nd array is with all true values.
Suppose eg n = 4;
1st array :
false true false true true true true true false false false true false true true false
In this array there are two connected segments(the ones with true values). 1st is (0,1)-(1,1)-(1,0)-(1,2)-(1,3)-(0,3)
2nd is (3,1)-(3,2).
What we have to do is - from each connected segments select topmost-leftmost element (1st priority is top, 2nd priority is left) and initialize all the elements of the connected segment with false value except the topmost-leftmost element.
so in the example,
1st connected segment topmost leftmost element is (0,1) and
2nd connected segment topmost leftmost element is (3,1).
so, our 2nd 2d array will be
true true true false false false false false true true true false true true false false
So, my question is given any 2d array(1st one), give the 2nd 2d array as output.
Note: Edited 11:46 AM 2/1/2013.