top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

WAP for Given a 2D matrix.

+7 votes
214 views

Each cell was filled with a specific color denoted by single character eg. for blue -‘B’. If one position is clicked (x,y), colour present at that position would be deleted.If the same colour is present in neighbourhood (up/down/left/right) then it would also be deleted. After deletion blank spaces will be replaced by the value present in the cell above that. In case no value present above the cell then blank entry will be replaced by 0.

Input
x:1 y:1
BGB
BGG
BBB
Output
B00
B0B
BBB

posted Nov 12, 2013 by Prakash Singh

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+6 votes

Given a matrix with 1s and 0s, please find the number of groups of 1s. A group is defined by horizontally or vertically adjacent 1s.

+2 votes

Does anyone know how to rotate a 2d matrix circularly for n times in suppose C language...? It would be a lot of help if you could explain with code.

Hint : Each time each row vector needs to be rotated one element to the right relative to the preceding row vector.

...