Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Word Pattern by matesik1995
def check_command(pattern, command):
binary = str(bin(pattern))[2:]
if len(binary) > len(command) : return False
while len(command)>len(binary) :
binary = '0'+binary
ret = True
for i in range(len(command)) :
if binary[i]=='0' :
if (command[i]<'0' or command[i]>'9') :
ret = False
break
if binary[i]=='1' :
if (command[i]>='0' and command[i]<='9') :
ret = False
break
return ret
print (check_command(2147483647,"Loremipsumdolorsitametconsecte9"))
Dec. 10, 2016