Shortest Palindrome

Hard

📝 Description

Add characters in front to make shortest palindrome

Input Format

String s

Output Format

Shortest palindrome

Constraints

0 ≤ s.length ≤ 5 * 10^4

🔍 Sample Input

"aacecaaa"
            

✅ Sample Output

"aaacecaaa"
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run