Dashboard Temp Share Shortlinks Frames API

HTMLify

LeetCode - Minimum String Length After Removing Substrings - Python
Views: 343 | Author: abh
1
2
3
4
5
6
class Solution:
    def minLength(self, s: str) -> int:
        while "AB" in s or "CD" in s:
            s = s.replace("AB", "")
            s = s.replace("CD", "")
        return len(s)