Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 与排序好的数组转化为二分搜索树的题相似,可以先把链表转化为数组在转化为树。 /*** Definition for singly-linked list.* struct
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes’ values. For example, Given {1,2,3,4}, reorder it to {1,4