Created
June 26, 2020 09:34
-
-
Save EvelynSubarrow/732e42ae40e03ee0a8446dbef78e2a65 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 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