Door panel codes
Your task
A door panel unlocks when a finger slides across its keys rather than tapping them. key_rows gives the pad one row at a time, every row the same width, and each character is either a key label or a dot for a dead cell no finger may touch. Labels are single characters and no label repeats. A code starts at start_key, and each key after that must sit directly above, below, left or right of the key before it, never diagonally. No key may be used twice. Return every code of exactly code_length keys, each written as its labels run together with nothing between them, sorted in ascending order. Return an empty list when the pad has no rows, when start_key is not printed on the pad, or when no code of that length exists.
Examples
list_swipe_codes(key_rows: list[str], start_key: str, code_length: int) -> list[str]Example 1
Input
list_swipe_codes(["123", "456", "789"], "5", 3)Output
["521", "523", "541", "547", "563", "569", "587", "589"]Example 2
Input
list_swipe_codes(["12", "34"], "1", 4)Output
["1243", "1342"]Example 3
Input
list_swipe_codes(["12", "3."], "1", 3)Output
[]