Number of Islands

Medium
Graphs DFS BFS
Implement the Number of Islands algorithm. Input: as specified Output: result

Constraints

Standard constraints apply.

Examples

Example 1:
Input: sample
Output:
Example 2:
Input: test
Output:

Hints

Consider a dfs approach.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.