摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 阅读全文
posted @ 2017-10-02 20:29 Tsunami_lj 阅读(57) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 方法一:牛顿迭代 f(x)=f(x0)+f'(x0)(x-x0) >x=x0-f(x0)/f'(x0) 在此处f(x)=x^2-n, f'(x)=2x,代入并整理得 阅读全文
posted @ 2017-10-02 20:14 Tsunami_lj 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: You s 阅读全文
posted @ 2017-10-02 17:04 Tsunami_lj 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n). 阅读全文
posted @ 2017-10-02 16:19 Tsunami_lj 阅读(90) 评论(0) 推荐(0) 编辑