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/remove_adjacent_dup.cpp | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 other/remove_adjacent_dup.cpp (limited to 'other/remove_adjacent_dup.cpp') diff --git a/other/remove_adjacent_dup.cpp b/other/remove_adjacent_dup.cpp deleted file mode 100644 index c0cc341..0000000 --- a/other/remove_adjacent_dup.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - string removeDuplicates(string s, int k) { - // cout << s << endl << k << endl; - if (s.size() < k) - return s; - stack> stk; - for (int i = 0; i < s.size(); ++i) { - if (stk.empty() || stk.top().first != s[i]) - stk.push({s[i], 1}); - else { - auto prev = stk.top(); - stk.pop(); - stk.push({s[i], prev.second + 1}); - } - if (stk.top().second == k) - stk.pop(); - } - string ans = ""; - while (!stk.empty()) { - auto curr = stk.top(); - stk.pop(); - while (curr.second--) - ans.push_back(curr.first); - } - reverse(ans.begin(), ans.end()); - // cout << ans; - return ans; - } -}; - -int main() { - Solution obj; - obj.removeDuplicates("deeedbbcccbdaa", 3); -} -- cgit v1.2.3