DAYS
HOUR
MINS
SEC
Error
Given a string, eliminate all “b” and “ac” in the string, replace them in-place and iterate over the string once.
Example 1:
Input: str = "aacbacc"
Output: ac
Explanation: Iterate once and remove
occurrence of "b" and "ac"
Example 2:
Input: str = "aacb"
Output: a
Explanation: Iterate once and remove
occurrence of "b" and "ac"
Your task:
Your task is to complete the function stringFilter
() which takes a single string as input and returns the string. You need not take any input or print anything.
Expected Time Complexity: O(|s|)
Expected Auxiliary Space: O(1)
Constraints:
1 <= |S| <= 105
String contains lower case alphabets
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes