随笔分类 - leetcode
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol
        阅读全文
                
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 
        阅读全文
                
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l
        阅读全文
                
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree.
        阅读全文
                
摘要:题意:根据二叉树的中序遍历和后序遍历恢复二叉树。 解题思路:看到树首先想到要用递归来解题。以这道题为例:如果一颗二叉树为{1,2,3,4,5,6,7},则中序遍历为{4,2,5,1,6,3,7},后序遍历为{4,5,2,6,7,3,1},我们可以反推回去。由于后序遍历的最后一个节点就是树的根。也就是
        阅读全文
                
摘要:I Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree{
        阅读全文
                
摘要:Convert Sorted List to Binary Search Tree Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST
        阅读全文
                
摘要: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 the dept
        阅读全文
                
摘要:I、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 given sum.
        阅读全文
                
摘要:Given a string S and a string T, count the number of distinct subsequences ofT inS. A subsequence of a string is a new string which is formed from the
        阅读全文
                
摘要:1、 Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to N
        阅读全文
                
摘要:1、Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] 
        阅读全文
                
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo
        阅读全文
                
摘要:1、 Say you have an array for which the i th element is the price of a given stock on day i . If you were only permitted to complete at most one transa
        阅读全文
                
摘要:Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example:Given the below binary tree, Return 6.
        阅读全文
                
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan
        阅读全文
                
摘要:Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: For example, Given:start
        阅读全文
                
摘要:Word Ladder Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: For e
        阅读全文
                
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given[100, 4, 200, 1, 3, 2],The longest
        阅读全文
                
摘要: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->3which re
        阅读全文
                
                    
                
浙公网安备 33010602011771号