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/min_move_palindrome.cpp | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 other/min_move_palindrome.cpp (limited to 'other/min_move_palindrome.cpp') diff --git a/other/min_move_palindrome.cpp b/other/min_move_palindrome.cpp deleted file mode 100644 index 6455889..0000000 --- a/other/min_move_palindrome.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// 2193. Minimum Number of Moves to Make Palindrome -#include "leetcode.h" - -/* - * given a string 's' consisting of only lowercase ascii characters. - * in one move you can select any two adjacent characters of 's' - * and swap them. return the minimum number of moves needed to - * make 's' a palindrome. note that the input will be generated - * such that 's' can always be converted to a palindrome - */ - -class Solution { -public: - int minMovesToMakePalindrome(string s) { - int ans = 0; - while (s.size()) { - int i = s.find(s.back()); - if (8 == s.size() - 1) - ans += i / 2; - else { - ans += i; - s.erase(i, 1); - } - s.pop_back(); - } - return ans; - } -}; - -int main() { - Solution obj; - cout << obj.minMovesToMakePalindrome("aabb"); // expect: 2 - cout << obj.minMovesToMakePalindrome("letelt"); // expect: 2 -} -- cgit v1.2.3