随笔分类 - LeetCode
摘要:问题 力扣 你需要采用前序遍历的方式,将一个二叉树转换成一个由括号和整数组成的字符串。 空节点则用一对空括号 "()" 表示。而且你需要省略所有不影响字符串与原始二叉树之间的一对一映射关系的空括号对。 示例 1: 输入: 二叉树: [1,2,3,4] 1 / \ 2 3 / 4 输出: "1(2(4
阅读全文
摘要:Problem LeetCode Given an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level
阅读全文
摘要:Problem LeetCode Given an n-ary tree, return the preorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between
阅读全文
摘要:Problem LeetCode Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down t
阅读全文
摘要:Problem LeetCode Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes
阅读全文
摘要:Problem LeetCode Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: I
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). Example 1: Input: root = [
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return the leftmost value in the last row of the tree. Example 1: [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传
阅读全文
摘要:Problem LeetCode Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all
阅读全文
摘要:Problem LeetCode Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their lev
阅读全文
摘要:Problem LeetCode Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [
阅读全文
摘要:Problem LeetCode Given the root of a binary tree, return the preorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [1
阅读全文
摘要:Problem LeetCode Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf
阅读全文
摘要:Problem LeetCode Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for th
阅读全文
摘要:Problem LeetCode Given a complete binary tree, count the number of nodes. Note: Definition of a complete binary tree from Wikipedia: In a complete bin
阅读全文
摘要:Problem LeetCode Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the
阅读全文

浙公网安备 33010602011771号