Instacart OA Question 2024 May | Strings & DP | on-campus

Question · Posted Jun 2026

Question: Longest Palindromic Substring Problem Statement Given a string s, return the longest palindromic substring in s. Constraints 1 <= s.length <= 1000 s consists of only digits and English letters. Examples Example 1: Input: s = "babad" Output: "bab" Explanation 1: "bab" is a valid answer. "aba" is also a valid answer. Both are palindromic substrings of length 3 — the longest in the string. We expand around center index 1 ('a') to find "bab", and around index 2 ...

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

Log in Create a free account