Guys, why don't we do something like this :
1. If (arrayHasBeenTraversed, Goto 4).
Else, Traverse the 2-D array [row,column] wise. Inspect element
array[row][column]. Goto 2.
2. If you encounter a '1' (array[row][column]),
change all the 0's in the corresponding [row,column] to '-1'
Also, don't do anything if you encounter a '1'.
3. Goto 1.
4. Scan the array, change all '-1s' to 1s. Finish.
Send your comment.
Cheers,
Amit
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.