Easy & Clear Solution Python3
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def findCircleNum(self, cnx: List[List[int]]) -> int:\n        res=0\n        n=len(cnx)\n        def dfs(i):\n            cnx[i][i]=2\n            for j in range(0,n):\n                if cnx[i][j]==1:\n                    cnx[i][j]=2\n                    dfs(j)\n        for i in range(0,n):\n            if cnx[i][i]==1:\n                res+=1\n                dfs(i)\n        return res\n\n```
['Depth-First Search', 'Python3']