You are given a string moves representing a sequence of moves starting at the origin
Each character in moves specifies a direction:
'U': Move
'D': Move
'L': Move
'R': Move
'_': Can be replaced by any one of the four moves 'U', 'D', 'L', or 'R'
Return the maximum Manhattan distance from the origin
Note: The Manhattan distance between two points
and is .
Constraints:
moves.length
moves consists only of 'U', 'D', 'L', 'R', and '_'
You are given a string moves representing a sequence of moves starting at the origin
Each character in moves specifies a direction:
'U': Move
'D': Move
'L': Move
'R': Move
'_': Can be replaced by any one of the four moves 'U', 'D', 'L', or 'R'
Return the maximum Manhattan distance from the origin
Note: The Manhattan distance between two points
and is .
Constraints:
moves.length
moves consists only of 'U', 'D', 'L', 'R', and '_'