Check if a given string is a rotation of a palindrome
Easy Accuracy: 50.13% Submissions: 497 Points: 2

Given a string s, check if it can be rotated to form a palindrome.

Example 1:

Input:
s = aaaab
Output: 1 
Explanation: "aaaab" can be rotated to
form "aabaa" which is a palindrome.


Your Task:  
You dont need to read input or print anything. Complete the function isRotatedPalindrome() which takes a string as input parameter and returns 1 if rotated palindrome is possible, otherwise 0.


Expected Time Complexity: O(N2) where N is length of s
Expected Auxiliary Space: O(N)

 

Constraints:
1 <= s.length() <= 104

 

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Check if a given string is a rotation of a palindrome

Output Window