Practice Alphabet Board Path
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Use the board rows ["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"], starting at row 0, column 0. Commands U, D, L, and R move one cell in the corresponding direction, and may only enter positions containing letters. The command ! appends the current letter to the output without moving. Return a shortest command string that produces target. Any shortest valid command string is accepted.
Source: Alphabet Board Path on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
target = "leet"
"DDR!UURRR!!DDD!"
# Example 2
target = "code"
"RR!DDRR!UUL!R!"
Constraints
Related LeetCode Problems
Practice more problems similar to Alphabet Board Path.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.