Motive interview question

- binary tree related - javascript