Amazon interview question

Encode and decode a BST into a string (write a function to store it in string format, then a function to read it into a BST)

Interview Answer

Anonymous

Nov 5, 2022

You can use a preorder traversal with keeping track of the root to encode and decode the BST.