Reads The Same Both Ways
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L5
Problem
Auditing free-text fields in a data export, you need the longest contiguous stretch of a string `s` that reads the same forwards and backwards. If several stretches tie for that maximum length, return the one with the smallest starting index.
Summary
Somewhere in the noise, a stretch that mirrors itself. Find the longest one.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.