Ad
  • Default User Avatar

    No, the input is a list. AVL trees seem a little too complicated. The solution is simpler than that. You could build a tree from the list, but it is not necessarily needed.

  • Custom User Avatar

    The Node class is only available in the trainer, where it is preloaded. If you want to try it outside the trainer, either in the browser or in your code editor, here it is:

    function Node(data, left, right) {
      this.data = data;
      this.left = left;
      this.right = right;
    }
    

    Edit : JS version of the Node class, not the Python one.