From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/string_compression.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 other/string_compression.cpp (limited to 'other/string_compression.cpp') diff --git a/other/string_compression.cpp b/other/string_compression.cpp deleted file mode 100644 index 5f9b9c6..0000000 --- a/other/string_compression.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int compress(vector &chars) { - string ans; - int c = 1, i; - for (i = 1; i < chars.size(); i++) { - if (chars[i] == chars[i - 1]) - c++; - else if (chars[i] != chars[i - 1] && c == 1) - ans += chars[i - 1]; - else { - ans += chars[i - 1]; - ans += to_string(c); - c = 1; - } - } - if (c == 1) - ans += chars[i - 1]; - else - ans += chars[i - 1] + to_string(c); - for (int i = 0; i < ans.size(); i++) - chars[i] = ans[i]; - vector::iterator it, ty; - it = chars.begin() + ans.size(); - ty = chars.begin() + chars.size(); - chars.erase(it, ty); - return ans.size(); - } -}; -- cgit v1.2.3