### LeetCode全题解

LeetCode全题解

2 已关注
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
386
• #### 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
624

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

2015-10-02 21:13
831
• #### 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
675
• #### 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
729
• #### 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
678
• #### LeetCode题解：Populating Next Right Pointers in Each Node

2015-10-02 21:01
541
• #### 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
632
• #### 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
574
• #### 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
776
• #### 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
603
• #### 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
322
• #### 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
585
• #### 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
528
• #### 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
514
• #### 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
366
• #### 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
497

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

2015-10-02 19:27
602
• #### LeetCode题解：Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2-...

2015-10-02 19:26
570
• #### LeetCode题解：Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ ->...

2015-10-02 19:19
973