摘要:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 阅读全文
posted @ 2017-07-16 22:59
白天黑夜每日c
阅读(94)
评论(0)
推荐(0)
摘要:
Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space 阅读全文
posted @ 2017-07-16 22:46
白天黑夜每日c
阅读(131)
评论(0)
推荐(0)
摘要:
Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,3,2]. Note: Re 阅读全文
posted @ 2017-07-16 22:23
白天黑夜每日c
阅读(140)
评论(0)
推荐(0)
摘要:
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2017-07-16 21:48
白天黑夜每日c
阅读(145)
评论(0)
推荐(0)
摘要:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2017-07-16 21:48
白天黑夜每日c
阅读(116)
评论(0)
推荐(0)
摘要:
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia:This problem was inspired by this original tweet by Max Howell: Go 阅读全文
posted @ 2017-07-16 21:47
白天黑夜每日c
阅读(138)
评论(0)
推荐(0)

浙公网安备 33010602011771号