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

Bonus Practice Sheet Winter 2018 [17-Mar-2018 to 7-Apr-2018]

Program ID- 1052

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


Please Comment Working if the code worked to you

If you have other working codes please comment the codes enclosing with <pre> and </pre> 🙂

Example: <pre> Your Code </pre>

C++ Code 

Follow for important news/announcements in VIT
The Above Codes are for reference only. It doesn't mean everyone to directly copy/paste those codes.


Click Here to Leave a Comment Below 0 comments

Leave a Reply:

This site uses cookies and by using the site you are consenting to this.