Tap here to switch tabs
Problem
Submissions

Problem: Remove All Occurrences of a Substring

med
30 min
Try to solve the Remove All Occurrences of a Substring problem.

Statement

Given two strings s and part, repeatedly remove the leftmost occurrence of part from s until s no longer contains part as a substring. Return the final string after all removals.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • 1≤1 \leq part.length ≤1000\leq 1000

  • s and part consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove All Occurrences of a Substring

med
30 min
Try to solve the Remove All Occurrences of a Substring problem.

Statement

Given two strings s and part, repeatedly remove the leftmost occurrence of part from s until s no longer contains part as a substring. Return the final string after all removals.

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • 1≤1 \leq part.length ≤1000\leq 1000

  • s and part consist of lowercase English letters.