We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defpalindromeIndex(s):# Write your code heredefisPalindrome(s,start,end):whilestart<end:ifs[start]!=s[end]:returnFalsestart+=1end-=1returnTruen=len(s)start=0end=n-1whilestart<end:ifs[start]!=s[end]:ifisPalindrome(s,start+1,end):returnstartelifisPalindrome(s,start,end-1):returnendelse:return-1start+=1end-=1return-1
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Palindrome Index
You are viewing a single comment's thread. Return to all comments →