| 1 | class Solution { |
| 2 | public String removeOccurrences(String s, String part) { |
| 3 | StringBuilder sb = new StringBuilder(); |
| 4 | int n = s.length(); |
| 5 | int m = part.length(); |
| 6 | for(char ch : s.toCharArray()){ |
| 7 | sb.append(ch); |
| 8 | if(sb.length() >= m){ |
| 9 | String sub = sb.substring(sb.length()-m); |
| 10 | if(sub.equals(part)){ |
| 11 | sb.setLength(sb.length()-m); |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | return sb.toString(); |
| 16 | } |
| 17 | } |
nothing calls this directly
no outgoing calls
no test coverage detected