Skip to content

Instantly share code, notes, and snippets.

View swapanj162's full-sized avatar

Swapan Jain swapanj162

View GitHub Profile
@swapanj162
swapanj162 / palindrome.cpp
Created August 19, 2023 02:17
Given a string s, return the longest palindromic substring in s.
class Solution {
public:
string longestPalindrome(string s) {
//brute force-O(n^3)
//My solution-O(n^2)
if(s.length()<1)
{
return "";