diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/remove_substring.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/remove_substring.cpp')
-rw-r--r-- | other/remove_substring.cpp | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/other/remove_substring.cpp b/other/remove_substring.cpp deleted file mode 100644 index a5572be..0000000 --- a/other/remove_substring.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// 1910. Remove All Occurrences of a Substring -#include "leetcode.h" - -/* - * given two strings 's' and 'part', perform the following operation on 's' - * until all occurrences of the substring 'part' are removed; find the leftmost - * occurrence of the substring 'part' and remove it from 's'. return 's' after - * removing all occurrences of 'part'. a substring is a contiguous sequence of - * characters in a string - */ - -class Solution { -public: - string removeOccurrences(string s, string part) { - while (s.size() && s.find(part) < s.size()) - s.erase(s.find(part), part.size()); - return s; - } -}; - -int main() { - Solution obj; - cout << obj.removeOccurrences("daabcbaabcbc", "abc") << endl; // expect: dab - cout << obj.removeOccurrences("axxxxyyyyb", "xy") << endl; // expect: ab -} |