[Python3] iterative dfs
Please check out this commit for solutions of weekly 266. \n\n\nclass Solution:\n    def maximalPathQuality(self, values: List[int], edges: List[List[int]], max
Please check out this [commit](https://github.com/gaosanyong/leetcode/commit/6b6e6b9115d2b659e68dcf3ea8e21befefaae16c) for solutions of weekly 266. \n\n```\nclass Solution:\n    def maximalPathQuality(self, values: List[int], edges: List[List[int]], maxTime: int) -> int:\n        graph = [[] for _ in values]\n        for u, v, t in edges: \n            graph[u].append((v, t))\n            graph[v].append((u, t))\n        \n        ans = 0 \n        stack = [(0, values[0], 0, 1)]\n        while stack: \n            time, val, u, mask = stack.pop()\n            if u == 0: ans = max(ans, val)\n            for v, t in graph[u]: \n                if time + t <= maxTime: \n                    if not mask & 1<<v: stack.append((time+t, val+values[v], v, mask ^ 1<<v))\n                    else: stack.append((time+t, val, v, mask))\n        return ans \n```
['Python3']