Leetcode Depth First Search Dfs Algorithm Python