記錄: 2017/6

0

Convert Sorted Array to Binary Search Tree

Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST. 提示 解題應用 DepthFirstSearch InorderTravel Default:12

0

Binary Tree Zigzag Level Order Traversal

Binary Tree Zigzag Level Order TraversalGiven a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate

0

Validate Binary Search Tree

Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less

0

Unique Binary Search Trees II

Unique Binary Search Trees IIGiven an integer n, generate all structurally unique BST’s (binary search trees) that store values 1…n. For example:Given n = 3, your program should return all 5 unique B

0

Unique Binary Search Trees

Unique Binary Search TreesGiven 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’s. 123451 3 3

0

Binary Tree Inorder Traversal

Binary Tree Inorder TraversalGiven a binary tree, return the inorder traversal of its nodes’ values. For example:Given binary tree [1,null,2,3], 123451 \ 2 /3 return [1,3,2]. Note: Recursive solutio