leetcode830
public class Solution
{
public IList<IList<int>> LargeGroupPositions(string S)
{
//"babaaaabbb"
var list = new List<IList<int>>();
int len = S.Length;
if (len > )
{
var last = S[];
var begin = ;
var end = S.Length - ; for (int i = ; i < len; i++)
{
var cur = S[i];
if (last != cur)
{
end = i - ;
var dif = end - begin + ;
if (dif >= )
{
var poslist = new List<int>();
poslist.Add(begin);
poslist.Add(end);
list.Add(poslist);
}
last = S[i];
begin = i;
}
end = i;
} if (end - begin >= )
{
var list3 = new List<int>();
list3.Add(begin);
list3.Add(end);
list.Add(list3);
}
} return list;
}
}
leetcode830的更多相关文章
- [Swift]LeetCode830. 较大分组的位置 | Positions of Large Groups
In a string S of lowercase letters, these letters form consecutive groups of the same character. For ...
- Leetcode830.Positions of Large Groups较大分组的位置
在一个由小写字母构成的字符串 S 中,包含由一些连续的相同字符所构成的分组. 例如,在字符串 S = "abbxxxxzyy" 中,就含有 "a", " ...
- 使用Python一步一步地来进行数据分析总结
原文链接:Step by step approach to perform data analysis using Python译文链接:使用Python一步一步地来进行数据分析--By Michae ...
随机推荐
- countDown
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...
- autoconf / automake工具使用介绍
本文转自:http://blog.csdn.net/gulansheng/article/details/42683809 一.简介 作为Linux下的程序开发人员,一定都遇到过Makefile,用m ...
- #Eclipse web工程 部署 三种方式 3
Eclipse web工程 部署 三种方式 3.热部署 在Eclipse中,实现 修改一个.java文件或者.jsp文件甚至是配置文件,不需要重启WEB服务器的前提下让修改生效,实现tomcat自动加 ...
- iphone——日期处理
http://blog.csdn.net/lingedeng/article/details/6996599 Dates NSDate类提供了创建date,比较date以及计算两个date之间间隔的功 ...
- python函数参数总结
python中函数参数有:默认参数.关键字参数.非关键字可变长参数(元组).关键字可变长参数(字典) 默认参数:在函数声明时,指定形参的默认值,调用时可不传入改参数(使用默认值)def foo(x): ...
- ecmall 挂件开发实例一
(参考网上相关文章,进行测试点评,下述方法测试成功) 1:在页面上添加要展示的页面模块 <div class="left" area="bottom_foot&q ...
- pandas之DateFrame
float_df = pd.DataFrame((0.45*np.arange(1,9)).reshape(4,2), index=[1,2,3,4], columns=['col_one', 'co ...
- ora-01658: 无法为表空间*****中的段创建 INITIAL 区
ora-01658: 无法为表空间*****中的段创建 INITIAL 区 原因:表空间不足 增大表空间.如果表空间动态增长,则扩大表空间的最大值.
- Renesas CAT CONFIG
CAT CELL "sf_cellular_api.h" typedef enum e_sf_cellular_at_cmd_index { SF_CELLULAR_AT_CMD_ ...
- jmeter踩坑系列
1.踩坑系列一: 抓包出来有host的字段,放到jmeter里面一起请求就报错了,去掉就请求正常了 1.踩坑系列二: 从花瓶复制过去 的values 前面有空格,肉眼看起来没有