✅Accepted| | ✅Easy solution || ✅Short & Simple || ✅Best Method
\n# Code\n\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode(
\n# Code\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}\n * };\n */\nclass Solution {\npublic:\n    bool findPath(TreeNode* root, TreeNode* target, vector<TreeNode*>& path)\n    {\n        if(!root)\n            return false;\n        path.push_back(root);\n        if(root==target)\n        return true;\n        if(findPath(root->left, target, path))\n            return true;\n        if(findPath(root->right, target, path))\n            return true;\n        path.pop_back();\n        return false;\n    }\n    void findNode(TreeNode* t, int k, vector<int>& ans, TreeNode* b)\n    {\n        if(k<0 || t==NULL || (b && b==t))\n            return;\n        if(k==0)\n        {\n            ans.push_back(t->val);\n            return;\n        }\n        findNode(t->left, k-1, ans, b);\n        findNode(t->right, k-1, ans, b);\n    }\n    vector<int> distanceK(TreeNode* root, TreeNode* target, int k) {\n        vector<TreeNode*> path;\n        findPath(root, target, path);\n        for(auto t:path)\n            cout<<t->val<<" ";\n        reverse(path.begin(), path.end());\n        vector<int> ans;\n        for(int i=0;i<path.size();i++)\n        {\n            findNode(path[i], k-i, ans, i==0 ? NULL:path[i-1]);\n        }\n        return ans;\n    }\n};\n```\nPlease **UPVOTE** if it helps \u2764\uFE0F\uD83D\uDE0A\nThank You and Happy To Help You!!
['C++']