Twitter | Remove Substring Recursively
9962

Given two strings s and t. Find the maximum number of times that one can recursively remove t from s.

Example 1:

Input: s = "aabcbc", t = "abc"
Output: 2
Explanation: We can first remove s[1:3] and s becomes "abc". We can then remove it all.

Example 2:

Input: s = "abababaaba", t = "ababa"
Output: 2
Comments (11)