You are viewing a single comment's thread. Return to all comments →
def depth(elem): max_child = 0 for child in elem: max_child = max(max_child, depth(child)) return bool(len(elem)) + max_child input() # skip first line root = et.parse(sys.stdin).getroot() print(depth(root))
Seems like cookies are disabled on this browser, please enable them to open this website
XML2 - Find the Maximum Depth
You are viewing a single comment's thread. Return to all comments →