public static boolean dfsBtree(TreeNode root, int total, int sum) {
        if (root.left == null && root.right == null) {
            if (total == sum) {
                return true;
            } else {
                return false;
            }
        } else {
            boolean flagl, flagr;
            flagl = flagr = false;
            
            if (root.left != null) {
                flagl = dfsBtree(root.left, total + root.left.val, sum);
            }
            
            if (root.right != null) {
                flagr = dfsBtree(root.right, total + root.right.val, sum);
            }
            
            return flagl || flagr;
        }
    }