Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created October 28, 2013 12:03
Show Gist options
  • Save cocodrips/7195711 to your computer and use it in GitHub Desktop.
Save cocodrips/7195711 to your computer and use it in GitHub Desktop.
SRM595 Div2 250
class LittleElephantAndBallsAgain:
def getNumber(self, S):
c = S[0]
longest = 0
l = 1
for s in S[1::]:
if s != c:
longest = max(longest, l)
l = 1
c = s
else:
l += 1
longest = max(longest, l)
return len(S) - longest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment