Difficulty Level : Easy
Submissions : 1646
Asked In :
Marks :10
: 26 | : 0
You are given a map of a building, and your task is to count the number of its rooms. The size of the map is $$$n \times m$$$ squares, and each square is either floor or wall. You can walk left, right, up, and down through the floor squares.
The first input line has two integers $$$n$$$ and $$$m$$$: the height and width of the map.
Then there are $$$n$$$ lines of $$$m$$$ characters each describing the map. Each character is either '.' (floor) or '#' (wall).
Print one integer: the number of rooms.
5 8 ######## #..#...# ####.#.# #..#...# ########
3
$$$1 \leq n, m \leq 1000$$$
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.