You are given a string s representing a sequence of moves on a k. A person starts at coordinate
Each character in s represents a movement:
'U' moves
'D' moves
'L' moves
'R' moves
You must remove exactly one contiguous substring of length k from s. After the substring is removed, the remaining characters are concatenated in their original order, and the person executes the resulting sequence of moves starting from
Return the number of distinct final coordinates reachable.
Constraints:
s.length
s consists only of 'U', 'D', 'L', and 'R'
k s.length
You are given a string s representing a sequence of moves on a k. A person starts at coordinate
Each character in s represents a movement:
'U' moves
'D' moves
'L' moves
'R' moves
You must remove exactly one contiguous substring of length k from s. After the substring is removed, the remaining characters are concatenated in their original order, and the person executes the resulting sequence of moves starting from
Return the number of distinct final coordinates reachable.
Constraints:
s.length
s consists only of 'U', 'D', 'L', and 'R'
k s.length