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_star_string.cpp | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 other/remove_star_string.cpp (limited to 'other/remove_star_string.cpp') diff --git a/other/remove_star_string.cpp b/other/remove_star_string.cpp deleted file mode 100644 index c7cbfb5..0000000 --- a/other/remove_star_string.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// 2390. Removing Stars From a String -#include "leetcode.h" - -/* - * given a string 's', which contains stars (*). in one operation - * you can choose a start in 's', remove the closest non-star - * character to its left, as well remove the star itself. - * return string after all stars have been removed. note, the - * input will be generated such that the operation is always - * possible, and the resulting string will always be unique - */ - -class Solution { -public: - string removeStars(string s) { - stack stk; - string ans; - vector vec; - for (int i = 0; i < s.size(); i++) { - if (s[i] != '*') - stk.emplace(s[i]); - else - stk.pop(); - } - while (!stk.empty()) { - vec.emplace_back(stk.top()); - stk.pop(); - } - reverse(vec.begin(), vec.end()); - for (int i = 0; i < vec.size(); i++) - ans += vec[i]; - return ans; - } -}; - -int main() { - Solution obj; - cout << obj.removeStars("leet**cod*e") << endl; // expect: lecoe - cout << obj.removeStars("erase*****") << endl; // expect: null -} -- cgit v1.2.3