问题描述在字符串中找出连续最长的数字串,并将该串返回。(略有修改)解决思路双指针法。一前一后,注意保存最长连续数字串的开始或者结束位置和最长串的长度,最后返回该子串即可。程序public class LongestContinuousDigits { public String getLCD(Str...
分类:
其他好文 时间:
2015-07-10 10:46:11
阅读次数:
99
#include#includeusing namespace std;int arr[100066];int main(){ int n,m; scanf("%d%d",&n,&m); for(int i=0 ; i<n ; ++i) scanf("%d",&arr[i]); sor...
分类:
其他好文 时间:
2015-03-04 06:12:08
阅读次数:
153
Problem
An army of n droids is lined up in one row. Each droid is described by m integers a1,?a2,?...,?am, where ai is the number of details of the i-th type in this droid’s m...
分类:
其他好文 时间:
2015-02-15 13:33:42
阅读次数:
155
原题地址基本模拟题,双指针法代码: 1 int removeElement(int A[], int n, int elem) { 2 int i = 0; 3 int j = 0; 4 5 while (i < n) { 6 ...
分类:
其他好文 时间:
2015-02-02 12:00:21
阅读次数:
128
原题地址双指针法。右指针不断向右试探,当遇到重复字符时停下来,此时左指针开始向右收缩,直到去掉那个重复字符。代码: 1 int lengthOfLongestSubstring(string s) { 2 map record; 3 int maxLen = 0; 4...
分类:
其他好文 时间:
2015-01-29 19:20:25
阅读次数:
140