Skip to content

Commit 24392a3

Browse files
Sync LeetCode submission Runtime - 0 ms (100.00%), Memory - 19.3 MB (22.92%)
1 parent e0b06d9 commit 24392a3

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
class Solution:
22
def furthestDistanceFromOrigin(self, moves: str) -> int:
3-
left = moves.count('L')
4-
right = moves.count('R')
5-
free = moves.count('_')
6-
7-
return max(left+free-right, right+free-left)
3+
return max(len(moves) - 2*moves.count('L'), len(moves) - 2*moves.count('R'))

0 commit comments

Comments
 (0)