Currently, only LeetCode TreeNode implemented.
- Converting
[5, 3, 6, 2, 4, null, 7]
->TreeNode(5, TreeNode(3,...), TreeNode(6,...))
pip install pyleetcode-utils
TreeNode usage:
from pyleetcode_utils import null
from pyleetcode_utils.datatypes import tree
class Solution:
@tree.make_tree
def findTarget(self, root: tree.TreeNode, k: int) -> bool:
...
Solution().findTarget([5, 3, 6, 2, 4, null, 7], 9)