Dsa
Two Pointers
Medium
Symmetric Subarray
Write a function that identifies the longest symmetric subarray in a given list of integers. A symmetric subarray is one where elements read the same backward as forward. Return the length of the longest symmetric subarray.
Input:
- A single line containing space-separated integers representing the array elements.
Output:
- Print the length of the longest symmetric subarray.
Example:
Input:
1 2 3 2 1
Output:
5
Key concepts
two_pointerssubarray_analysis
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now