New update is available. Click here to update.

Topics

This time our favorite Ninja wants to buy a house. But they are unable to count the number of rooms in the house. So they need your help to count the number of rooms.

```
A house is represented by a matrix where “\” and “/” represent a wall and blank space is empty space. We will consider two rooms different if we will be unable to reach another room.
```

Your task is to return the number of rooms. For a better explanation, see the example.

```
Input:
[
“ /”
“/\”
]
Output: 3
Explanation: 2 X 2 house is shown below:
```

Detailed explanation

```
1 <= T <= 5
2 <= N <= 30
Time limit: 1 sec
```

```
2
2
\/
/\
3
/ /
/
/
```

```
4
3
```

```
In test case 1, We can see there are 4 separate rooms.
```

```
In test case 2, we can see there are 3 separate rooms.
```

```
1
2
/
/\
```

```
3
```

```
In test case 1, We can see there are 4 separate rooms.
```