top of page

Problem 2

Verification of 'L' shaped arrangement of coins on game board (Id-1052)

 

Question:         

Consider an nxn board game with four types of coins red, green, blue and yellow. Given the state of the board with coins in all cells, develop an algorithm and write a C program to check if the same coins are placed in  the shape of ‘L’  on the board. The number of cells in the vertical and horizontal line of ‘L’ shape, is same. Red coins are represented by ‘r’, blue coins are represented by ‘b’, green coins are represented by ‘g’ and yellow coins are represented by ‘y’. 

For example, given the configuration of a 4 X 4 board with coins as shown below, the program must print 'Yes' since the coin 'r' is placed in the positions (3,2), (4,2),(4,3),(4,4) form an 'L' shape.

b r y r

r r y b

y r b b

b r r r

Input Format:

Number of rows

Number of columns

Elements in the matrix(board), given row by row

Output Format:

Print Yes or No

OUTPUT
INPUT
PROCESSING

I'm a paragraph. Click here to add your own text and edit me. It's easy.

I'm a paragraph. Click here to add your own text and edit me. It's easy.

I'm a paragraph. Click here to add your own text and edit me. It's easy.

C  PROGRAM

I'm a paragraph. Click here to add your own text and edit me. It's easy.

bottom of page