Tuesday, June 9, 2015

Leetcode 109: sorted list to binary search tree (II)

problem description:
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
这道题花了我三个小时调试, 开始, 我没有用全局变量; 最简单的测试通不过; 仔细想有些什么漏洞.  Spent over 3 hours on April 24, 2015, try to figure out the problem. Before, instead of using global variable list, a local variable is used as the recursive function argument. Learn a lesson, make my day more exciting.
C# code is accepted by leetcode on April 25, 2015

https://github.com/jianminchen/LinkedListToBST/blob/master/Program.cs

No comments:

Post a Comment