Ram is visiting a public park composed of 1 x 1 squares. These squares may or may not contain diagonal brick walls dividing the park into contiguos regions.
Help Ram count the number of regions.
You'll be given a string array of length n (length of a side of park) where every string will be of length n
consisting of "/", "" or blank space ' '.
Example 1:
park = [" /","/ "]
Output: 2
Example 2:
park = [" /"," "]
Output: 1
Example 3:
park = ["/","/"]
Output: 2
Example 4 :
park = ["//","/ "]
Output: 3Input Format
A number n. String array consisting of n strings, each of size n. Input is handled for you. You just need to complete the function.
Output Format
"Find out the number of regions of park" (Output Format is handled for you.)
Constraints
1. n == park.length 2. n == park[i].length 3. 1 <= n <= 30 4. park[i][j] is either "/", "", or blank space ' '.
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
2 / /
Output
2