Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvelynSubarrow/732e42ae40e03ee0a8446dbef78e2a65 to your computer and use it in GitHub Desktop.
Save EvelynSubarrow/732e42ae40e03ee0a8446dbef78e2a65 to your computer and use it in GitHub Desktop.
def validate(ts: str) -> bool:
dotcount = [1000]*10
for digit in ts:
if digit.isnumeric():
intdigit = int(digit)
if (dotcount[10-intdigit]<3): return False
dotcount[intdigit] = 0
elif digit==".":
dotcount = [a+1 for a in dotcount]
else:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment