[c++] Easy to understand || with explanation||Time complexity=0(N)
Think in this way that we have left subtree and right subtree and a root\n- we return -1 if there is no apple on the subtree\n- means if all subtree returns -1 
- Think in this way that we have left subtree and right subtree and a root\n- we `return -1` if there is no apple on the subtree\n- means if all subtree returns -1 that is no apple exist in the subtree, **now before return -1** `check is root consist apple? if yes:return 0:else return-1`\n- Assume if any subtree not return -1(`so here we add +2` to the answer, why? because we travel to the edge two times).\n\n **Time comlexity=0(N)** As we visit every node once\n\n# Code\n```\nclass Solution {\npublic:\n   int helper(int node,unordered_map<int,vector<int>>&child,vector<bool>& hasApple){\n        if(child.find(node)==child.end()){\n            if(hasApple[node])return 0;\n            return -1;\n        }\n        int res=0;\n        for(auto it:child[node]){\n            int t=helper(it,child,hasApple);\n            if(t!=-1)res+=(t+2);\n        }\n        if(res==0&&!hasApple[node])return -1;\n        return res;\n   }\n \n    int minTime(int n, vector<vector<int>>& edges, vector<bool>& hasApple) {\n        unordered_map<int,vector<int>>child;\n        unordered_map<int,int>parent;\n        for(auto it:edges){\n            if(parent.find(it[1])==parent.end()){\n            child[it[0]].push_back(it[1]);\n            parent[it[1]]=it[0];\n            }\n            else{\n            child[it[1]].push_back(it[0]);\n            parent[it[0]]=it[1];\n            }\n        }\n        int ans= helper(0,child,hasApple);\n        return max(0,ans);\n    }\n};\n```
['Hash Table', 'Depth-First Search', 'Design', 'C++']