The best solution is adding a parent pointer for the BST


  • 0
    T

    In the interview, you will be free to choose BST structure. See the chapter about BST in "Introduction to algorithm"


  • 1
    S

    Doesn't make sense at all. We know a parent node will be useful but we're given the class structure. Imagine you're on a screen interview or there's some sort of testing case, do you really want to change what is given to you>


Log in to reply
 

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