摘要:
Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within 10-5 of the actual answer
阅读全文
posted @ 2025-03-27 20:47
ZhangZhihuiAAA
阅读(4)
推荐(0)
摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes
阅读全文
posted @ 2025-03-27 19:46
ZhangZhihuiAAA
阅读(14)
推荐(0)
摘要:
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear i
阅读全文
posted @ 2025-03-27 16:58
ZhangZhihuiAAA
阅读(23)
推荐(0)
摘要:
You are given the root of a binary tree containing digits from 0 to 9 only. Each root-to-leaf path in the tree represents a number. For example, the r
阅读全文
posted @ 2025-03-26 22:17
ZhangZhihuiAAA
阅读(9)
推荐(0)
摘要:
Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the
阅读全文
posted @ 2025-03-26 17:48
ZhangZhihuiAAA
阅读(9)
推荐(0)
摘要:
Given the root of a binary tree, flatten the tree into a "linked list": The "linked list" should use the same TreeNode class where the right child poi
阅读全文
posted @ 2025-03-26 12:12
ZhangZhihuiAAA
阅读(9)
推荐(0)
摘要:
Given a binary tree struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next right node. If there
阅读全文
posted @ 2025-03-26 11:34
ZhangZhihuiAAA
阅读(8)
推荐(0)
摘要:
Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the
阅读全文
posted @ 2025-03-26 09:09
ZhangZhihuiAAA
阅读(10)
推荐(0)
摘要:
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the sa
阅读全文
posted @ 2025-03-24 22:26
ZhangZhihuiAAA
阅读(3)
推荐(0)
摘要:
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1,2,2,3,4,4,3]
阅读全文
posted @ 2025-03-24 09:22
ZhangZhihuiAAA
阅读(13)
推荐(0)