Skip to content

Conversation

PYDIMARRI-HEMA-HARSHINI-23-586
Copy link
Contributor

Fix #12941 : Corrected base case in is_palindrome_recursive in strings/palindrome.py of Python directory.

Previously, the base case used if len(s) <= 2: return True, which incorrectly treated any 2-character string as a palindrome (for example, "AB" returned True). Updated the base case to len(s) <= 1 so that two-character strings are compared for equality and only empty/single-character strings auto-pass.

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Sep 4, 2025
@MaximSmolskiy MaximSmolskiy changed the title Fix: is_palindrome_recursive logic for 2-char strings in strings/palindrome.py Fix is_palindrome_recursive logic in strings/palindrome.py Sep 4, 2025
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Sep 4, 2025
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Sep 4, 2025
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Sep 4, 2025
@MaximSmolskiy MaximSmolskiy merged commit 544f48f into TheAlgorithms:master Sep 4, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants