← Questions

Can left and right pieces slide into a target string

0
GoogleCodingLast asked Jul 2025

A string holds pieces that can only move left, pieces that can only move right, blanks, and walls that nothing passes. Given a start and a target string, decide whether the start can be turned into the target by sliding pieces through blanks in their allowed direction. Compare the pieces in order with two pointers and check each one's position against its direction and the walls.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding