GoLang Solution For LeetCode Problem: Convert Sorted Array to Binary Search Tree
Solving Convert Sorted Array to Binary Search Tree in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
Problem Description
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
Example:
Given the sorted array: [-10,-3,0,5,9],
One possible answer is: [0,-3,9,-10,null,5], which represents the following height balanced BST:
0
/ \
-3 9
/ /
-10 5
See the full details of the problem Convert Sorted Array to Binary Search Tree at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go
Comments
Leave a comment
You are not LoggedIn but you can comment as an anonymous user which requires manual approval. For better experience please Login.