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/longest_palindrome_concat.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 other/longest_palindrome_concat.cpp (limited to 'other/longest_palindrome_concat.cpp') diff --git a/other/longest_palindrome_concat.cpp b/other/longest_palindrome_concat.cpp deleted file mode 100644 index 3a42e0a..0000000 --- a/other/longest_palindrome_concat.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int longestPalindrome(vector &words) { - unordered_map um; - for (auto w : words) - ++um[w]; - int ans = 0, center = 0, sz = 2; - for (auto [w, cnt] : um) { - auto reversed = string(rbegin(w), rend(w)); - if (w == reversed) { - ans += 2 * (cnt / 2); - center |= cnt % 2; - } else { - auto it = um.find(reversed); - if (it != end(um)) - ans += min(cnt, it->second); - } - } - return sz * ans + (center ? sz : 0); - } -}; - -int main() { - Solution obj; - vector words = {"lc", "cl", "gg"}; - cout << obj.longestPalindrome(words); -} -- cgit v1.2.3