Created
November 1, 2015 17:10
-
-
Save PengFoo/51c0428fb67447abaf6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find(s): | |
res,start,cur = [],1,s[0] | |
for index,i in enumerate(s): | |
if i != cur: | |
res.append((start,index)) | |
start = index + 1 | |
cur = i | |
res.append((start,len(s))) | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment