0
def printAllRootToKnodePaths(root, k, arr=[]):
    if root is None:
        return False

    if root.data == k:
        arr.append(root.data)
        return True
    leftTree = printAllRootToKnodePaths(root.left, k)
    if leftTree:
        arr.append(root.data)
        print(arr)

        return True
    rightTree = printAllRootToKnodePaths(root.right, k)
    if rightTree:
        arr.append(root.data)
        return True
    # if printAllRootToKnodePaths:

    # print(arr)
    return False
Paul R
  • 208,748
  • 37
  • 389
  • 560
  • Welcome to StackOverfow! Please tel us what is your question? How do you call your function? What are the arguments? – Dima Chubarov Jul 19 '22 at 12:21
  • See this: ["Least Astonishment" and the Mutable Default Argument](https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument) – Jesper Jul 19 '22 at 12:23

0 Answers0