private TreeNode _sortedListToBST(ListNode head) {
        if (head == null) {
            return null;
        }
        
        ListNode slow = head, fast = head;
        while (fast != null && fast.next != null && fast.next.next != null) {
            fast = fast.next.next;
            slow = slow.next;
        }
        TreeNode root = new TreeNode(slow.next.val);
        slow.next = null;
        ListNode right_head = slow.next.next;
        
        root.left = _sortedListToBST(head);
        root.right = _sortedListToBST(right_head);
        return root;
    }