这个题要注意一下,容易错,辅助遍历函数有返回值。 ...
分类:
其他好文 时间:
2018-06-09 20:31:34
阅读次数:
199
题目:给定一字符串,求其无重复字符的最长子串长度。 思路:for循环一次,时间复杂度为O(N)。字符的ascii值为32~126。start表示当前无重复字符子串的初始位置,初始值为0;可定义一个位置数组pos[128]表示for循环索引到当前位置时相应的字符对应的位置。若当前字符s[i](其asc ...
分类:
编程语言 时间:
2018-06-08 22:37:27
阅读次数:
279
In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g ...
分类:
其他好文 时间:
2018-06-08 21:55:26
阅读次数:
151
题目描述: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters ...
分类:
其他好文 时间:
2018-06-07 19:18:44
阅读次数:
170
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence {0.1, 0.2, 0.3, 0.4}, we h ...
分类:
其他好文 时间:
2018-06-06 01:10:37
阅读次数:
167
题目描述: Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Note: There may be more than one LIS combinatio ...
分类:
其他好文 时间:
2018-06-03 14:30:57
阅读次数:
142
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi ...
分类:
其他好文 时间:
2018-06-03 14:20:25
阅读次数:
146
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: ...
分类:
其他好文 时间:
2018-06-02 12:55:40
阅读次数:
157
class Solution { public: int findNumberOfLIS(vector& nums) { if (nums.size() == 0) return 0; pair res = {0, 0}; // vector> dp(nums.size(), {1,1}); // ... ...
分类:
其他好文 时间:
2018-06-01 16:20:29
阅读次数:
112