Dsa
Graphs Dfs
Easy
Room Mapper
You are given a 2D grid of rooms where 'R' represents a room and 'W' represents a wall. Write a function to find the largest area of connected rooms. The area is defined as the number of rooms that are connected vertically or horizontally.
Input Format:
- The first line contains two integers, m and n (dimensions of the room grid).
- The following m lines each contain n characters ('R' or 'W').
Output Format:
- Print the size of the largest connected area of rooms.
Example Input:
4 4
R R W R
R W R R
W R R W
R R R R
Example Output:
7
Key concepts
graphsdfsroom mapping
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now