LeetCode
文章平均质量分 80
枫叶果酱
这是我的Leetcode专题博客~我的Github是www.github.com/wkcn
展开
-
【LeetCode】105. Construct Binary Tree from Preorder and Inorder Traversal
题目描述:Given preorder and inorder traversal of a tree, construct the binary tree.给定一棵二叉树的先序遍历与中序遍历,构造出这棵二叉树。解题思路:对于一棵二叉树:记某个节点为V, 其左子树为L,右子树为R先序遍历:VLR中序遍历:LVR后序遍历:LRV得到二叉树的先序遍历VL原创 2016-09-27 20:54:34 · 318 阅读 · 0 评论 -
【LeetCode】306. Additive Number
题目描述:Additive number is a string whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number原创 2016-10-18 08:42:39 · 422 阅读 · 0 评论 -
【LeetCode】220. Contains Duplicate III
问题描述:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] andnums[j] is at most t and the difference between原创 2016-10-18 07:40:27 · 476 阅读 · 0 评论 -
【LeetCode】300. Longest Increasing Subsequence
关键词:最长递增子序列问题描述:Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequen原创 2016-10-23 21:11:37 · 282 阅读 · 0 评论 -
【LeetCode】337. House Robber III
题目描述:给定一棵二叉树, 选定一些不相邻(不互为父子关系)的节点, 对这些节点求和,求和的最大值.解题思路:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * Tr原创 2016-10-18 22:08:47 · 387 阅读 · 0 评论 -
【LeetCode】391. Perfect Rectangle
题目描述:Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover of a rectangular region.Each rectangle is represented as a bottom-left point and a top-ri原创 2016-08-31 22:09:51 · 538 阅读 · 1 评论 -
【LeetCode】126. Word Ladder II
题目链接:https://leetcode.com/problems/word-ladder-ii/题目描述:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginW原创 2016-09-07 18:43:03 · 514 阅读 · 0 评论 -
【LeetCode】4. Median of Two Sorted Arrays
题目描述:给定两个已排序的整数数列(长度分别为m和n),求出他们的中位数。要求时间复杂度为O(log (m+n)).如:nums1 = [1, 3]nums2 = [2]The median is 2.0nums1 = [1, 2]nums2 = [3, 4]The median is (2 + 3)/2 = 2.5题目分析:由于题目原创 2016-09-20 07:50:37 · 399 阅读 · 0 评论 -
【LeetCode】2. Add Two Numbers
问题描述:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as原创 2016-09-27 19:51:55 · 500 阅读 · 2 评论 -
【LeetCode】5.Longest Palindromic Substring
关键词:最长回文字串,Manacher算法问题描述:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length ofS is 1000, and there exists one unique longest palindromic s原创 2016-10-11 19:38:14 · 293 阅读 · 0 评论 -
【LeetCode】3. Longest Substring Without Repeating Characters
题目描述:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b原创 2016-09-27 20:15:38 · 272 阅读 · 0 评论 -
【LeetCode】410. Split Array Largest Sum
关键词:二分法问题描述:Given an array which consists of non-negative integers and an integer m, you can split the array intom non-empty continuous subarrays. Write an algorithm to minimize the largest原创 2016-11-14 21:11:11 · 538 阅读 · 0 评论