Checks if current node is not None and doesn 't have any children
if ( root != None and len ( root . children ) == 0 ) : NEW_LINE INDENT ans = max ( ans , ( root . val ) ) NEW_LINE return [ root . val , 1 ] NEW_LINE DEDENT