Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
with python 3.8+ solution in Clear category for Keys and Locks by Phil15
def keys_and_locks(lock, key):
lock, key = (trim(x.strip().splitlines()) for x in (lock, key))
return any((key := rotate90(key)) == lock for _ in range(4))
def rotate90(obj): return list(zip(*reversed(obj)))
def trim(s):
for _ in range(4):
while '#' not in s[-1]:
s.pop()
s = rotate90(s)
return s
Oct. 1, 2019