Answer: Instacart OA Question 2024 May | Strings & DP | on-campus
Answer · Posted Jun 2026
Solution: Longest Palindromic Substring — Expand Around Center Approach We use the Expand Around Center technique. Every palindrome is centered around either a single character (odd length) or between two characters (even length). For each of the 2N - 1 possible centers, we expand outward while characters match and track the longest found. For each index i, expand for both odd-length (i, i) and even-length (i, i+1) centers. Track the start index and maximum length of the best palindrome found ...
The full answer & interview discussion are available to premium members.
Log in Create a free account