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/find_replace_pattern.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 other/find_replace_pattern.cpp (limited to 'other/find_replace_pattern.cpp') diff --git a/other/find_replace_pattern.cpp b/other/find_replace_pattern.cpp deleted file mode 100644 index a00bfcb..0000000 --- a/other/find_replace_pattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - vector findAndReplacePattern(vector &words, string pattern) { - ans.resize(0); - codex.clear(); - cipher = pattern; - for (int i = 0; i < pattern.size(); i++) - cipher[i] = translate(cipher[i]); - for (auto &word : words) - compare(word); - return ans; - } - -private: - vector ans; - unordered_map codex; - string cipher; - char translate(char &c) { - if (codex.find(c) == codex.end()) - codex[c] = (char)(97 + codex.size()); - return codex[c]; - } - void compare(string &word) { - codex.clear(); - for (int i = 0; i < word.size(); i++) - if (translate(word[i]) != cipher[i]) - return; - ans.push_back(word); - } -}; -- cgit v1.2.3