[C++] Easy to understand Solution, Beats 95% submissions
\nvector<int> distanceK(TreeNode* root, TreeNode* target, int K) {\n        unordered_map<TreeNode*, TreeNode*> parent_track; // node -> parent\n        unorder
```\nvector<int> distanceK(TreeNode* root, TreeNode* target, int K) {\n        unordered_map<TreeNode*, TreeNode*> parent_track; // node -> parent\n        unordered_map<TreeNode*, bool> visited;\n        queue<TreeNode*> queue;\n        queue.push(root);\n        while(!queue.empty()) { /*First BFS to get a track of parent nodes*/\n            TreeNode* current = queue.front(); queue.pop();\n            if(current->left) {\n                parent_track[current->left] = current;\n                queue.push(current->left);\n            }\n            if(current->right) {\n                parent_track[current->right] = current;\n                queue.push(current->right);\n            }\n        }\n        queue.push(target);\n        visited[target] = true;\n        int curr_level = 0;\n        while(!queue.empty()) { /*Second BFS to go upto K level from target node and using our hashtable info*/\n            int size = queue.size();\n            if(curr_level++ == K) break;\n            for(int i=0; i<size; i++) {\n                TreeNode* current = queue.front(); queue.pop();\n                if(current->left && !visited[current->left]) {\n                    queue.push(current->left);\n                    visited[current->left] = true;\n                }\n                if(current->right && !visited[current->right]) {\n                    queue.push(current->right);\n                    visited[current->right] = true;\n                }\n                if(parent_track[current] && !visited[parent_track[current]]) {\n                    queue.push(parent_track[current]);\n                    visited[parent_track[current]] = true;\n                }\n            }\n        }\n        vector<int> result;\n        while(!queue.empty()) {\n            TreeNode* current = queue.front(); queue.pop();\n            result.push_back(current->val);\n        }\n        return result;\n    }\n```
['Breadth-First Search', 'C', 'C++']