#DFS
ほぼ日刊競プロ leetcode 543. Diameter of Binary Tree
543. Diameter of Binary Tree
Given the root of a binary tree, return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two nodes in a
ほぼ日刊競プロ leetcode 145. Binary Tree Postorder Traversal
145. Binary Tree Postorder Traversal
Given the root of a binary tree, return the postorder traversal of its nodes' values.
二分木が与えられるので,値を帰りがけ法で探索し値を返せ
考えた事帰りがけ方のなので以下のように探索する必要がある.
根のノードが最後に来るように探索
ほぼ日刊競プロ leetcode 104. Maximum Depth of Binary Tree
104. Maximum Depth of Binary Tree
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the
ほぼ日刊競プロ leetcode 938. Range Sum of BST
938. Range Sum of BST
Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high].
考えたこと上記のように2分木に