Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

s =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Every palindrome expands from a center.

Approach

For each index i, expand around:

  • odd center (i,i)
  • even center (i,i+1) Track the best window.

Why it works

Any palindrome has a center at a character (odd) or between characters (even).

Code
Loading...
Complexity
Time: O(n^2)
Space: O(1)
Solution
Updated: 2026-02-23

Idea

Every palindrome expands from a center.

Approach

For each index i, expand around:

  • odd center (i,i)
  • even center (i,i+1) Track the best window.

Why it works

Any palindrome has a center at a character (odd) or between characters (even).

Code
Loading...
Complexity
Time: O(n^2)
Space: O(1)