1910. Remove All Occurrences of a Substring

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1910

class Solution:
    def removeOccurrences(self, s: str, part: str) -> str:
        while part in s:
            s = s.replace(part, '', 1)
        return s