随笔分类 - leetcode
algorithn
摘要:题目链接 https://leetcode.com/problems/binary tree preorder traversal/description/ 题目描述 Given a binary tree, return the preorder traversal of its nodes' v
阅读全文
摘要:题目链接 https://leetcode.com/problems/path sum ii/description/ 题目描述 Given a binary tree and a sum, find all root to leaf paths where each path's sum equa
阅读全文
摘要:题目链接 https://leetcode.com/problems/binary tree paths/description/ 题目描述 Given a binary tree, return all root to leaf paths. Note: A leaf is a node with
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/sort colors/description/ 题目描述 给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。 此题中,我们使用整数 0、 1
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/search in rotated sorted array ii/description/ 题目描述 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,0,1,2,2,5,6] 可能变为 [2,
阅读全文
摘要:题目链接 https://leetcode.com/problems/search in rotated sorted array/description/ 题目描述 Suppose an array sorted in ascending order is rotated at some pivo
阅读全文
摘要:题目链接 https://leetcode.com/problems/binary tree level order traversal ii/description/ 题目描述 Given a binary tree, return the bottom up level order traver
阅读全文
摘要:题目链接 https://leetcode.com/problems/average of levels in binary tree/description/ 题目描述 Given a non empty binary tree, return the average value of the n
阅读全文
摘要:题目链接 https://leetcode.com/problems/trim a binary search tree/description/ 题目描述 Given a binary search tree and the lowest and highest boundaries as L a
阅读全文
摘要:题目链接 https://leetcode.com/problems/find bottom left tree value/description/ 题目描述 Given a binary tree, find the leftmost value in the last row of the t
阅读全文
摘要:题目链接 https://leetcode.com/problems/most frequent subtree sum/description/ 题目描述 Given the root of a tree, you are asked to find the most frequent subtr
阅读全文
摘要:题目链接 https://leetcode.com/problems/n ary tree preorder traversal/description/ 题目描述 Given an n ary tree, return the preorder traversal of its nodes' va
阅读全文
摘要:题目链接 https://leetcode.com/problems/kth smallest element in a bst/description/ 题目描述 Given a binary search tree, write a function kthSmallest to find th
阅读全文
摘要:题目链接 https://leetcode.com/problems/convert sorted array to binary search tree/description/ 题目描述 Given an array where elements are sorted in ascending
阅读全文
摘要:题目链接 https://leetcode.com/problems/n ary tree postorder traversal/description/ 题目描述 Given an n ary tree, return the postorder traversal of its nodes'
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/maximum depth of n ary tree/description/ 题目描述 给定一个N叉树,找到其最大深度。 最大深度是指从根节点到最远叶子节点的最长路径上的节点总数。 说明: 1. 树的深度不会超过 100
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/binary tree postorder traversal/description/ 题目描述 给定一个二叉树,返回它的 后序 遍历。 示例: 进阶: 递归算法很简单,你可以通过迭代算法完成吗? 题解 后序遍历,使用一个
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/binary tree inorder traversal/description/ 题目描述 给定一个二叉树,返回它的中序遍历 示例: 进阶: 递归算法很简单,你可以通过迭代算法完成吗? 题解 采用栈来遍历,一直遍历到最左
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/binary tree pruning/description/ 题目描述 给定二叉树根结点 root ,此外树的每个结点的值要么是 0,要么是 1。 返回移除了所有不包含 1 的子树的原二叉树。 ( 节点 X 的子树为 X
阅读全文
摘要:题目链接 https://leetcode cn.com/problems/maximum depth of binary tree/description/ 题目描述 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。
阅读全文

浙公网安备 33010602011771号