fix: 增加日记记录

This commit is contained in:
2023-06-13 16:37:18 +08:00
parent a4a8110c2b
commit 4a0eed5453
49 changed files with 7920 additions and 20 deletions

View File

@@ -0,0 +1,24 @@
from typing import List
def is_valid_walk(walk):
if len(walk) != 10:
return False
hasWalk = list()
for m in walk:
if (m == 'n' and hasWalk.index('s')>=0):
hasWalk.remove(hasWalk.index('s'))
elif (m == 's' and hasWalk.index('n')>=0):
hasWalk.remove(hasWalk.index('n'))
elif (m == 'e' and hasWalk.index('w')>=0):
hasWalk.remove(hasWalk.index('w'))
elif (m == 'w' and hasWalk.index('e')>=0):
hasWalk.remove(hasWalk.index('e'))
else:
hasWalk.append(m)
return len(hasWalk) == 0
print(is_valid_walk(['n','s','n','s','n','s','n','s','n','s']))