LeetCode 1910 Remove All Occurrences of a Substring - Optimal Solution using stack (Med, Java, O(n))
Overall Strategy
The algorithm uses a stack simulation with a character array to efficiently remove all occurrences of a substring. It processes the string character by character and removes matching substrings as soon as they're detected.
Code Break...
huanganni.hashnode.dev3 min read