I dont think this is the question that Max Howell was asked during interview.


  • 4
    H

    Please take a look at the original twitter tweets.
    https://twitter.com/mxcl/status/608682016205344768

    Max said in a reply: "
    Max Howell ‏@mxcl Jun 10
    @Jonathan_Blow @dan_schmidt I had to min max it."

    How could you explain the "min max it".

    I dont think Max was not able to swap left and right sub tree.


  • 3
    S

    I think it is the same question.

    Max Howell ‏@mxcl Jun 10 @rogerdai16 to min-max the tree, ascending
    to descending.

    In case we have BST left sub-tree contains smaller elements and right sub-tree contains greater elements, if they wanted him to reverse it so left sub-tree contained greater elements and right sub-tree contained smaller elements it is exactly the same problem.


  • 0
    S

    In English, "To invert" means to "to turn inside out or upside down; or to reverse". Thus, the somewhat vague wording used by MH is subject to many possible interpretations. It could as well fit the description of another OJ problem 'Binary Tree Upside Down', which is harder than the current problem.

    On the other hand, the current problem and 'Binary Tree Upside Down' are usually done with the modification of the tree structure, without touching the values stored in the nodes. If MH really had to 'min-max' it, then maybe he was specifically asked to not change the original tree connectivity, or maybe the problem he was facing was something completely different.

    Anyway, my guess is that the current problem is not very likely to be the original problem MH was asked, at least not without any restrictions or follow-up requirements.


  • 0
    J

    Yeah, mirroring a tree seems trivially simplistic, like one of the first problems you'd probably use when learning about recursion. I have to believe we are missing something here.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.