2211. Count Collisions on a Road Updated: 2024-03-12 1 min read Algorithms , LeetCode On This PageLeetCode problem 2211class Solution: def countCollisions(self, directions: str) -> int: d = directions.lstrip('L').rstrip('R') return len(d) - d.count('S')