We start at position 'a', on an alphabet board arranged as follows:
["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"]
We can make the following types of moves:
'U' moves the position up by
'D' moves the position down by
'L' moves the position left by
'R' moves the position right by
'!' adds the character at the current position on the board to the spelled string.
Every move must keep the position within the valid boundaries of the board.
Given a string target, return a sequence of moves to spell out the string target. Any valid path that produces the correct result will be accepted.
Constraints:
target.length
target consists only of lowercase English letters.
We start at position 'a', on an alphabet board arranged as follows:
["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"]
We can make the following types of moves:
'U' moves the position up by
'D' moves the position down by
'L' moves the position left by
'R' moves the position right by
'!' adds the character at the current position on the board to the spelled string.
Every move must keep the position within the valid boundaries of the board.
Given a string target, return a sequence of moves to spell out the string target. Any valid path that produces the correct result will be accepted.
Constraints:
target.length
target consists only of lowercase English letters.