Given a Singly Linked List which has data members sorted in ascending order. Construct a Balanced Binary Search Tree which has same data members as the given Linked List.
Note: There might be nodes with same value.
- Time : O(nlogn)
- Space : O(logn)
c++
1 | /* |
- Time : O(n)
- Space : O(n)
c++
1 | class Solution{ |