DFS
July树树
每个人都会变成自己最讨厌的样子。
展开
-
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the...原创 2019-12-06 15:05:56 · 122 阅读 · 0 评论 -
Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note:A leaf is a node with no childre...原创 2019-12-06 14:52:57 · 90 阅读 · 0 评论 -
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree[1,2,2,3,4,4,3]is symmetric: 1 / \ 2 2 / \ / \3 4 4 3...原创 2019-12-06 14:49:47 · 101 阅读 · 0 评论 -
Same Tree
Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example ...原创 2019-12-06 14:36:15 · 298 阅读 · 0 评论 -
Validate Binary Search Tree
Given 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 keysless thanthe node's key. The ...原创 2019-12-05 16:06:40 · 102 阅读 · 0 评论