Your question is One-Dimensional Tile Moves. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Suppose you have a one-dimensional board of two colors of tiles. Given a start and end configuration represented as a list of strings, return a list of valid moves to get from start to end, or None if none exist, including the start and end states in the list of moves.
Represent the empty position with "_". A valid move swaps the empty position with an immediately adjacent tile. Implement def solve_board(start, end):, where both arguments are lists of one-character strings and the result is a list of board states or None.
def solve_board(start, end):