自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(431)
  • 收藏
  • 关注

原创 LeetCode 114. Flatten Binary Tree to Linked List(摊平二叉树)

原题网址:https://leetcode.com/problems/flatten-binary-tree-to-linked-list/Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5

2016-05-24 00:19:26 504

原创 LeetCode 113. Path Sum II(路径和)

原题网址:https://leetcode.com/problems/path-sum-ii/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

2016-05-24 00:19:11 785

原创 LeetCode 112. Path Sum(路径和)

原题网址:https://leetcode.com/problems/path-sum/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.

2016-05-24 00:18:59 475

原创 LeetCode 111. Minimum Depth of Binary Tree(二叉树最小深度)

原题网址:https://leetcode.com/problems/minimum-depth-of-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 nod

2016-05-24 00:18:53 994

原创 LeetCode 110. Balanced Binary Tree(平衡二叉树)

原题网址:https://leetcode.com/problems/balanced-binary-tree/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

2016-05-24 00:12:55 540

原创 LeetCode 108. Convert Sorted Array to Binary Search Tree(数组转换为二叉搜索树)

原题网址:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/Given an array where elements are sorted in ascending order, convert it to a height balanced BST.方法:递归,自顶向下。/** *

2016-05-24 00:12:53 493

原创 LeetCode 109. Convert Sorted List to Binary Search Tree(链表到二叉搜索树)

原题网址:https://leetcode.com/problems/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.方法:使用慢指针

2016-05-24 00:12:46 575

原创 LeetCode 107. Binary Tree Level Order Traversal II(二叉树分层遍历)

原题网址:https://leetcode.com/problems/binary-tree-level-order-traversal-ii/Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by le

2016-05-24 00:12:44 433

原创 LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal(根据中序遍历和后序遍历构造二叉树)

原题网址:https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume

2016-05-24 00:12:37 447

原创 LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal(从前序遍历和中序遍历构造二叉树)

原题网址:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume t

2016-05-24 00:12:34 447

原创 LeetCode 104. Maximum Depth of Binary Tree(二叉树高度)

原题网址:https://leetcode.com/problems/maximum-depth-of-binary-tree/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node

2016-05-24 00:12:30 518

原创 LeetCode 103. Binary Tree Zigzag Level Order Traversal(二叉树之字形遍历)

原题网址:https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right

2016-05-23 03:58:09 1343

原创 LeetCode 102. Binary Tree Level Order Traversal(二叉树分层遍历)

原题网址:https://leetcode.com/problems/binary-tree-level-order-traversal/Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For

2016-05-23 03:55:58 515

原创 LeetCode 101. Symmetric Tree(对称的树)

原题网址:https://leetcode.com/problems/symmetric-tree/Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric:

2016-05-23 03:22:34 704

原创 LeetCode 100. Same Tree(相同的树)

原题网址:https://leetcode.com/problems/same-tree/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 identic

2016-05-23 00:49:13 405

原创 LeetCode 91. Decode Ways(解码方法)

原题网址:https://leetcode.com/problems/decode-ways/A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an enco

2016-05-23 00:42:32 2577 1

原创 LeetCode 99. Recover Binary Search Tree(修复二叉搜索树)

原题网址:https://leetcode.com/problems/recover-binary-search-tree/Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol

2016-05-23 00:39:29 615

原创 LeetCode 98. Validate Binary Search Tree(校验二叉搜索树)

原题网址:https://leetcode.com/problems/validate-binary-search-tree/Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre

2016-05-23 00:39:15 492

原创 LeetCode 97. Interleaving String(字符串交织)

原题网址:https://leetcode.com/problems/interleaving-string/Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When

2016-05-23 00:39:00 946

原创 LeetCode 96. Unique Binary Search Trees(唯一二叉树)

原题网址:https://leetcode.com/problems/unique-binary-search-trees/Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a

2016-05-23 00:38:28 385

原创 LeetCode 95. Unique Binary Search Trees II(唯一二叉搜索树)

原题网址:https://leetcode.com/problems/unique-binary-search-trees-ii/Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your

2016-05-23 00:35:30 488

原创 LeetCode 94. Binary Tree Inorder Traversal(二叉树的中序遍历)

原题网址:https://leetcode.com/problems/binary-tree-inorder-traversal/Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1

2016-05-23 00:35:01 1002

原创 LeetCode 93. Restore IP Addresses(恢复IP地址)

原题网址:https://leetcode.com/problems/restore-ip-addresses/Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "2552551

2016-05-23 00:34:59 1172

原创 LeetCode 92. Reverse Linked List II(翻转链表)

原题网址:https://leetcode.com/problems/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->3->4->5->NULL, m = 2 and n = 4,

2016-05-23 00:34:57 418

原创 LeetCode 90. Subsets II(子集)

原题网址:https://leetcode.com/problems/subsets-ii/Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-d

2016-05-23 00:34:52 547

原创 LeetCode 89. Gray Code(格雷码)

原题网址:https://leetcode.com/problems/gray-code/The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total

2016-05-23 00:34:41 795

原创 LeetCode 87. Scramble String(字符串扰乱)

原题网址:https://leetcode.com/problems/scramble-string/Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible

2016-05-23 00:34:32 1660

原创 LeetCode 88. Merge Sorted Array(合并有序数组)

原题网址:https://leetcode.com/problems/merge-sorted-array/Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough

2016-05-23 00:34:29 359

原创 LeetCode 86. Partition List(链表分区)

原题网址:https://leetcode.com/problems/partition-list/Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should pres

2016-05-23 00:34:24 512

原创 LeetCode 85. Maximal Rectangle(最大矩形)

原题网址:https://leetcode.com/problems/maximal-rectangle/Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.方法:应用直方图最大矩形面积的方法。publ

2016-05-23 00:34:22 1763

原创 LeetCode 84. Largest Rectangle in Histogram(最大矩形)

原题网址:https://leetcode.com/problems/largest-rectangle-in-histogram/Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest

2016-05-23 00:34:09 463

原创 LeetCode 83. Remove Duplicates from Sorted List(删除重复节点)

原题网址:https://leetcode.com/problems/remove-duplicates-from-sorted-list/Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, r

2016-05-22 05:36:09 477

原创 LeetCode 82. Remove Duplicates from Sorted List II(删除链表中的重复节点)

原题网址:https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original

2016-05-22 05:32:45 679

原创 LeetCode 81. Search in Rotated Sorted Array II(搜索旋转的数组)

原题网址:https://leetcode.com/problems/search-in-rotated-sorted-array-ii/Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity

2016-05-22 05:30:00 397

原创 LeetCode 80. Remove Duplicates from Sorted Array II(删除重复)

原题网址:https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nu

2016-05-22 05:27:10 326

原创 LeetCode 79. Word Search(单词查找)

原题网址:https://leetcode.com/problems/word-search/Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where

2016-05-22 05:21:03 1162

原创 LeetCode 78. Subsets(子集)

原题网址:https://leetcode.com/problems/subsets/Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution se

2016-05-22 05:20:40 582

原创 LeetCode 77. Combinations(组合)

原题网址:https://leetcode.com/problems/combinations/Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[

2016-05-22 05:20:29 390

原创 LeetCode 76. Minimum Window Substring(最小窗口子串)

原题网址:https://leetcode.com/problems/minimum-window-substring/Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For ex

2016-05-22 05:19:30 589

原创 LeetCode 75. Sort Colors(颜色排序)

原题网址:https://leetcode.com/problems/sort-colors/Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order re

2016-05-22 05:19:20 589

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除