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_insertion_make_palindrome.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 other/min_insertion_make_palindrome.cpp (limited to 'other/min_insertion_make_palindrome.cpp') diff --git a/other/min_insertion_make_palindrome.cpp b/other/min_insertion_make_palindrome.cpp deleted file mode 100644 index 7af74da..0000000 --- a/other/min_insertion_make_palindrome.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// 1312. Minimum Insertion Steps to Make a String Palindrome -#include "leetcode.h" - -/* - * given string 's'. in one step you can insert any character at any index of - * the string. return the minimum number of steps to make 's' palindrome. a - * palindrome string is one that reads the same backward as well as forward. - */ - -class Solution { -public: - int minInsertions(string s) { - vector memo(s.size(), 0); - int prv, tmp; - for (int i = s.size() - 2; i >= 0; i--) { - prv = 0; - for (int j = i; j < s.size(); j++) { - tmp = memo[j]; - memo[j] = s[i] == s[j] ? prv : 1 + min(memo[j], memo[j - 1]); - prv = tmp; - } - } - return memo[s.size() - 1]; - } -}; - -int main() { - Solution obj; - printf("%d\n", obj.minInsertions("zzazz")); // expect: 0 - printf("%d\n", obj.minInsertions("mbadm")); // expect: 2 - printf("%d\n", obj.minInsertions("leetcode")); // expect: 5 -} -- cgit v1.2.3