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_palindromic_substr.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 other/longest_palindromic_substr.cpp (limited to 'other/longest_palindromic_substr.cpp') diff --git a/other/longest_palindromic_substr.cpp b/other/longest_palindromic_substr.cpp deleted file mode 100644 index 4ecba25..0000000 --- a/other/longest_palindromic_substr.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - string longestPalindrome(string s) { - if (s.size() == 0) - return ""; - int i = 0, j = 0, n = s.size(); - bool p[n][n] = {false}; - for (int x = 0; x < n; x++) { - p[x][x] = true; - if (x == n - 1) - break; - p[x][x + 1] = (s[x] == s[x + 1]); - } - for (int i = n - 3; i >= 0; --i) - for (int j = i + 2; j < n; ++j) - p[i][j] = (p[i + 1][j - 1] && s[i] == s[j]); - int max = 0; - string ans = ""; - for (int i = 0; i < n; i++) - for (int j = i; j < n; j++) - if (p[i][j] == true && j - i + 1 > max) { - max = j - i + 1; - ans = s.substr(i, j - i + 1); - } - return ans; - } -}; - -int main() { - Solution obj; - string s = "babad"; - cout << obj.longestPalindrome(s); -} -- cgit v1.2.3