- 博客(15)
- 收藏
- 关注
原创 【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
568
原创 【LeetCode】416. Partition Equal Subset Sum
关键词:动态规划, 滚动数组, 将数组划分成和相等的两部分题目描述:Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both sub
2016-11-03 15:38:55
367
原创 【LeetCode】6. ZigZag Conversion
题目描述:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P
2016-10-25 15:46:56
339
原创 【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
295
原创 【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
410
原创 【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
441
原创 【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
497
原创 【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
313
原创 【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
337
原创 【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
287
原创 【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
518
2
原创 【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
418
原创 【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
542
原创 【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
572
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人