随笔分类 - LeetCode
摘要:题目描述:(链接)Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are...
阅读全文
摘要:题目描述:(链接)Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each ne...
阅读全文
摘要:题目描述:(链接)Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3...
阅读全文
摘要:题目描述:(链接)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see b...
阅读全文
摘要:题目解析:(链接)Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree...
阅读全文
摘要:题目描述:(链接)Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the n...
阅读全文
摘要:题目描述:(链接)Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解题思路: 1 /** 2 * Definition for ...
阅读全文
摘要:题目描述:(链接)Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路: 1 /** 2 * Definition for a binary tre...
阅读全文
摘要:题目描述:(链接)Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique B...
阅读全文
摘要:题目描述:(链接)Given inorder and postorder traversal of a tree, construct the binary tree.解题思路: 1 /** 2 * Definition for a binary tree node. 3 * struct Tr...
阅读全文
摘要:题目描述:(链接)Given preorder and inorder traversal of a tree, construct the binary tree.解题思路: 1 /** 2 * Definition for a binary tree node. 3 * struct Tre...
阅读全文
摘要:题目解析:(链接)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 contai...
阅读全文
摘要:题目描述:(链接)Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The fl...
阅读全文
摘要:题目描述:(链接)Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which ...
阅读全文
摘要:题目描述:(链接)Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: ...
阅读全文
摘要:题目解析:(链接)Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the giv...
阅读全文
摘要:题目描述:(链接)Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally ide...
阅读全文
摘要:题目描述:(链接)Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) ...
阅读全文
摘要:题目解析:(链接)Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next lev...
阅读全文
摘要:题目描述:(链接)Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root...
阅读全文

浙公网安备 33010602011771号