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_string_chain.cpp | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 other/longest_string_chain.cpp (limited to 'other/longest_string_chain.cpp') diff --git a/other/longest_string_chain.cpp b/other/longest_string_chain.cpp deleted file mode 100644 index afa805c..0000000 --- a/other/longest_string_chain.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int longestStrChain(vector &words) { - vector> vus(17); - for (auto i : words) - vus[i.size()].insert(i); - unordered_map um; - int ans = 1; - for (int i = 16; i; i--) { - if (vus[i - 1].empty()) - continue; - for (auto j : vus[i]) { - int wVal = um[j] ? um[j] : 1; - for (int k = 0; k < j.size(); k++) { - string prev = j.substr(0, k) + j.substr(k + 1); - int pVal = um[prev] ? um[prev] : 1; - if (vus[i - 1].find(prev) != vus[i - 1].end() && wVal >= pVal) { - um[prev] = wVal + 1; - ans = max(ans, wVal + 1); - } - } - } - } - return ans; - } -}; - -int main() { - Solution obj; - vector words = {"a", "b", "ba", "bca", "bda", "bdca"}; - cout << obj.longestStrChain(words); -} -- cgit v1.2.3