- 博客(17)
- 资源 (5)
- 收藏
- 关注
原创 leetcode- Permutations II
题目: Permutations II Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[1
2015-06-29 14:52:24 683
原创 leetcode - Jump Game II
题目:Jump Game II Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length
2015-06-29 00:00:08 565
原创 leetcode - Next Permutation
题目:Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rea
2015-06-22 17:59:18 457
原创 leetcode - Divide Two Integers
题目:Divide Two Integers Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT. 分析:1、设法在不溢出的前提下,把除数和被除数转化成正数进行计算。
2015-06-22 16:11:32 499
原创 leetcode - Merge k Sorted Lists
题目:Merge k Sorted ListsMergek sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 分析:用multiset作为小根堆,multiset的begin是value最小的结点。注意:
2015-06-21 09:45:02 757
转载 leetcode - Container With Most Water
题目:Container With Most WaterGiven n non-negative integers a1, a2, ...,an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints
2015-06-20 20:37:06 418
原创 leetcode - Longest Palindromic Substring
题目:Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest
2015-06-20 16:35:32 628
原创 leetcode - Valid Number
题目:Valid NumberValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueclass Solution {public: bool is
2015-06-10 11:07:47 674
原创 leetcode - Regular Expression Matching
题目:Regular Expression Matching '.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The
2015-06-09 21:28:09 521
转载 leetcode - Count Complete Tree Nodes
题目:Count Complete Tree Nodes Given a complete binary tree, count the number of nodes.In a complete binary tree every level, except possibly the last, is completely filled, and all
2015-06-06 17:35:37 479
原创 manacher算法的实现
manacher算法的解释见 这里。//求字符串s中最大回文的长度,要求字符串s不包含字符‘#’int manacher(const string &s){ if (s.size() <= 1) return s.size(); //往s每个字符之间以及s的首尾都插入‘#’ string str(s.size() * 2 + 1, '#'); for (int
2015-06-05 11:51:31 1131
原创 【回文】leetcode - Shortest Palindrome
题目:Shortest Palindrome Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by perf
2015-06-05 11:01:33 771
原创 leetcode - Missing Ranges
题目:Missing RangesGiven a sorted integer array where the range of elements are [0, 99]inclusive, return its missing ranges.For example, given [0, 1, 3, 50, 75], return[“2”, “4->49”, “51->74”, “
2015-06-04 16:15:00 760
原创 leetcode - One Edit Distance
题目:One Edit DistanceGiven two strings S and T, determine if they are both oneedit distance apart.Hint:1. If | n – m | is greater than 1, we know immediately both are not one-editdistance a
2015-06-04 15:27:10 621
原创 【动态规划】leetcode - Maximal Square
题目:Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 0
2015-06-03 15:20:09 1112
转载 【字符串】KMP算法的实现
来源:脑客爱刷题vector GetNextArr(const string &match){ vector NextArr; if (match.empty()) return NextArr; if (match.size() == 1) return vector(1, -1); NextArr = vector(match.size()); NextArr
2015-06-02 11:07:53 417
原创 leetcode - Contains Duplicate III
题目: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] and nums[j] is at mo
2015-06-02 09:36:49 1047
VC++程序: 将字符串转换成公式并计算结果
2014-10-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人