Skip to content

Conversation

ARYPROGRAMMER
Copy link

Description of Change

This PR adds a comprehensive implementation of the Longest Palindromic Substring algorithm to the dynamic programming section.

The longest palindromic substring problem finds the contiguous substring of maximum length in a given string that is also a palindrome. This is different from the existing longest palindromic subsequence implementation, where characters don't need to be contiguous.

Key Features:

  • Two implementations provided:
    • Standard DP approach: O(n²) time, O(n²) space
    • Optimized expand-around-center: O(n²) time, O(1) space
  • 8 comprehensive test cases covering edge cases
  • Full Doxygen documentation with complexity analysis
  • Real-world applications included (DNA sequencing, text processing, bioinformatics)
  • Interactive examples demonstrating practical usage

Example:

  • Input: "bananas" → Output: "anana" (length 5)
  • Input: "racecar" → Output: "racecar" (length 7)

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes: Adds longest palindromic substring algorithm with DP and space-optimized implementations, 8 passing tests, and complete Doxygen documentation. Updates DIRECTORY.md accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant