Implement a generator that yields a binary tree's values in inorder traversal.
Constraints
Example
>>> class Node: ... def __init__(self, val=0, left=None, right=None): ... self.val = val ... self.left = left ... self.right = right >>> root = Node(1, None, Node(2, Node(3))) >>> list(inorder(root)) [1, 3, 2] >>> list(inorder(None)) []
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints