96% Tc and 94% Sc easy python solution
\ndef minTime(self, n: int, edges: List[List[int]], hasApple: List[bool]) -> int:\n\tadj = [[] for _ in range(n)]\n\tfor i, j in edges:\n\t\tadj[i].append(j)\n\
```\ndef minTime(self, n: int, edges: List[List[int]], hasApple: List[bool]) -> int:\n\tadj = [[] for _ in range(n)]\n\tfor i, j in edges:\n\t\tadj[i].append(j)\n\t\tadj[j].append(i)\n\tdef dfs(i, par):\n\t\ttemp = 0\n\t\tfor child in adj[i]:\n\t\t\tif(child != par):\n\t\t\t\ttemp += dfs(child, i)\n\t\tif((temp>0 or hasApple[i]) and par != -1):\n\t\t\ttemp += 2\n\t\treturn temp\n\treturn dfs(0, -1)\n```
['Depth-First Search', 'Python', 'Python3']