I came across this problem and can't seem to find a solution for it anywhere.
Given a binary tree where each node contains a number denoting the amount of left nodes in its subtree, write a function that returns the nth inorder traversal node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
self.leftNodes = 0
Finding the nth node of inorder traversal is fairly trivial, but how can I use the information about number of left nodes to improve the process?