diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/break_palindrom.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/break_palindrom.cpp')
-rw-r--r-- | other/break_palindrom.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/other/break_palindrom.cpp b/other/break_palindrom.cpp deleted file mode 100644 index d10c0e6..0000000 --- a/other/break_palindrom.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// 1328. Break a Palindrome -#include "leetcode.h" - -/* - * given a palindrome string of lowercase english letters 'palindrome' replace - * exactly one character with any lowercase english letter so that the resulting - * string is not a palindrome and that it is the lexicographically smallest one - * possible. return the resulting string. if there is no way to replace a - * character to make it not a palindrome, return an empty string. - */ - -class Solution { -public: - string breakPalindrome(string palindrome) { - int n = palindrome.size(); - if (n == 1) - return ""; - for (int i = 0; i < n / 2; i++) { - if (palindrome[i] != 'a') { - palindrome[i] = 'a'; - return palindrome; - } - } - palindrome[n - 1] = 'b'; - return palindrome; - } -}; - -int main() { - Solution obj; - cout << obj.breakPalindrome("abccba") << endl; // expect: aaccba - cout << obj.breakPalindrome("a") << endl; // expect: null -} |