minTime = function(n, edges, hasApple) {
    if (n === 1) return 0;
    const result = dfs(0, -1, makeGraph(edges), hasApple) - 2;
    return (result > 0 && result) || 0;
}
Graph | DFS 
Time O(n) | Space O(n)
https://leetcode.com/problems/minimum-time-to-collect-all-apples-in-a-tree/
@param {number} n
@param {number[][]} edges
@param {boolean[]} hasApple
@return {number}