← Amazon Interview Insights

Amazon·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Amazon SWE interview with a palindrome coding problem. Not much to say, it was a single algorithmic question and I got through it.

Questions Asked (1)

Q1

Find all palindromes in a given input.

Algorithms & Data Structures
Author's notes

Pretty classic problem but I fumbled the edge cases a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem first: are we finding all palindromic substrings, all palindromic subsequences, or all palindromes in a list of strings? Then choose an efficient algorithm like expanding around centers for substrings (O(n^2) time, O(1) space) or Manacher's algorithm for linear time, and discuss trade-offs.

Pro tip: Amazon interviewers value candidates who ask clarifying questions and discuss edge cases (empty string, single character, case sensitivity, non-alphanumeric characters) before coding. Also, mention that you'd test with examples and consider input size to choose the right approach.

1. Clarify requirements

Ask whether the input is a single string or a list, and whether we need all palindromic substrings, subsequences, or just the longest. Confirm if palindromes must be contiguous and if case and non-alphanumeric characters matter.

2. Discuss approaches

Outline brute force (check all substrings, O(n^3)), expanding around centers (O(n^2) time, O(1) space), and Manacher's algorithm (O(n) time). Explain trade-offs and choose one based on constraints.

3. Design algorithm

For expanding around centers: iterate over each character and each pair of adjacent characters as centers, expand outward while characters match, and collect palindromes. For Manacher's: preprocess string with separators and compute radii.

4. Handle edge cases

Consider empty string, single character, all same characters, and strings with spaces or punctuation. Decide on normalization (e.g., lowercase, remove non-alphanumeric) if needed.

5. Analyze complexity and test

State time and space complexity. Walk through a small example (e.g., 'abba') to verify correctness, and mention potential optimizations or alternative approaches.

Key Points to Mention

  • Definition of palindrome and types (substring vs subsequence)
  • Brute force vs optimized approaches (expanding around centers, Manacher's algorithm)
  • Time and space complexity trade-offs
  • Edge cases: empty string, single character, case sensitivity, non-alphanumeric characters
  • Handling duplicates and avoiding redundant checks
  • Testing with examples and discussing scalability

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.