class Solution:
def inorderTraversal(self, root: TreeNode) -> List[int]:
res, stack = [], []
node = root
while node is not None or stack:
while node:
stack.append(node)
node = node.left
if stack:
node = stack.pop(-1)
res.append(node.val)
node = node.right
return res