MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / solve

Method solve

TreePathToGivenNode.java:2–7  ·  view source on GitHub ↗
(TreeNode A, int B)

Source from the content-addressed store, hash-verified

1public class Solution {
2 public ArrayList<Integer> solve(TreeNode A, int B) {
3 ArrayList<Integer> list = new ArrayList<>();
4 if(A==null) return list;
5 travel(A,B,list);
6 return list;
7 }
8 public static boolean travel(TreeNode root, int B,ArrayList<Integer> list)
9 {
10 if(root==null) return false;

Callers

nothing calls this directly

Calls 1

travelMethod · 0.95

Tested by

no test coverage detected