Answer: Deloitte OA Question 2024 June | Strings & DP | on-campus

Answer · Posted Jun 2026

Solution: Palindromic Substrings — Expand Around Center Approach We use the Expand Around Center technique. Every palindrome has a center — either a single character (odd length) or the gap between two characters (even length). For each possible center in the string (there are 2N - 1 centers: N single characters + N-1 gaps), expand outward as long as the characters on both sides match. Each successful expansion counts as one palindromic substring. This avoids the O(N²) space of a ...

The full answer & interview discussion are available to premium members.

Log in Create a free account