2211. Count Collisions on a Road

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2211

class Solution:
    def countCollisions(self, directions: str) -> int:
        d = directions.lstrip('L').rstrip('R')
        return len(d) - d.count('S')