LeetCode全题解

LeetCode全题解

5 已关注
104篇博文
• LeetCode题解：Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题意：...

2015-10-02 20:43
408
• LeetCode题解：Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number...

2015-10-02 21:14
659

Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest t...

2015-10-02 21:13
879
• LeetCode题解：Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i.Design an alg...

2015-10-02 21:07
708
• LeetCode题解：Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were o...

2015-10-02 21:06
774
• LeetCode题解：Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n...

2015-10-02 21:04
718
• LeetCode题解：Populating Next Right Pointers in Each Node

2015-10-02 21:01
604
• LeetCode题解：Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example, Given 1 / \ 2 5...

2015-10-02 20:59
654
• LeetCode题解：Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given su...

2015-10-02 20:50
596
• LeetCode题解：Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height bala...

2015-10-02 20:45
818
• LeetCode题解：Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume tha...

2015-10-02 20:35
654
• LeetCode题解：Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that...

2015-10-02 20:16
345
• LeetCode题解：Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to...

2015-10-02 20:10
622
• LeetCode题解：Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as ...

2015-10-02 20:06
559
• LeetCode题解：Unique Binary Search Trees II

Given n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For exam...

2015-10-02 20:01
534
• LeetCode题解：Unique Binary Search Trees

Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example,...

2015-10-02 19:57
389
• LeetCode题解：Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tr...

2015-10-02 19:29
516

Given a string containing only digits, restore it by returning all possible valid IP address combina...

2015-10-02 19:27
654