JAVA - EASIEST Solution with EXPLANATION (MUST READ) 😁
\nint dis[] = new int[501];   //Because 500 is the max value and values are unique\n    \npublic List<Integer> distanceK(TreeNode root, TreeNode target, int K) 
```\nint dis[] = new int[501];   //Because 500 is the max value and values are unique\n    \npublic List<Integer> distanceK(TreeNode root, TreeNode target, int K) {\n\tfor(int i=0; i<501; i++) \n\t\tdis[i] = Integer.MAX_VALUE-100;\n\tdis[target.val] = 0;\n\n\t// Find distance of all nodes from target using 2 traversals.\n\tpropogateBackward(root);\n\tpropogateForward(root);\n\n\tList<Integer> sol = new ArrayList<>();\n\tfor(int i=0; i<501; i++)\n\t\tif(dis[i]==K) sol.add(i);   //If distance is K from target, add to solution list\n\n\treturn sol;\n}\n\n// Fill the minimum distance from bottom to top\nvoid propogateBackward(TreeNode root) {\n\tif(root.left!=null) {\n\t\tpropogateBackward(root.left);\n\t\tdis[root.val] = Math.min(dis[root.val], dis[root.left.val]+1);\n\t}\n\tif(root.right!=null) {\n\t\tpropogateBackward(root.right);\n\t\tdis[root.val] = Math.min(dis[root.val], dis[root.right.val]+1);\n\t}\n}\n\n// Fill the minimum distance from top to bottom\nvoid propogateForward(TreeNode root) {\n\tif(root.left!=null) {\n\t\tdis[root.left.val] = Math.min(dis[root.left.val], dis[root.val]+1);\n\t\tpropogateForward(root.left);\n\t}\n\tif(root.right!=null) {\n\t\tdis[root.right.val] = Math.min(dis[root.right.val], dis[root.val]+1);\n\t\tpropogateForward(root.right);\n\t}\n}\n```
[]