← reevo Interview Insights

reevo·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Did a coding round for a Software Engineer role at Reevo. One question, palindrome substrings, pretty classic stuff but I fumbled around more than I expected before landing on a clean approach.

Questions Asked (1)

Q1

Given a string, count the total number of substrings that are palindromes, including duplicates at different positions.

Algorithms & Data Structures
Author's notes

I knew the brute force immediately but sat there second-guessing whether O(n^2) was good enough.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., string length, character set) and discuss brute-force vs. optimized approaches. Present an O(n^2) expand-around-center solution that counts all palindromic substrings, including duplicates, and analyze its time and space complexity.

Pro tip: Mention that duplicates are counted separately because each occurrence at a different position is a distinct substring, and note that Manacher's algorithm can achieve O(n) if needed, but expand-around-center is simpler and often sufficient.

1. Clarify requirements and constraints

Ask about input size, character set, and whether empty substrings or single characters count. Confirm that duplicates at different positions are counted separately.

2. Discuss brute-force approach

Explain that checking all O(n^2) substrings and verifying each palindrome takes O(n^3) time, which is inefficient for large inputs.

3. Present optimized expand-around-center solution

For each character (and each pair of adjacent characters), expand outward while characters match, counting each valid palindrome. This runs in O(n^2) time and O(1) extra space.

4. Analyze complexity and edge cases

State time complexity O(n^2) and space O(1). Handle edge cases: empty string (0), single character (1), all same characters (n(n+1)/2).

5. Mention alternative O(n) approach

Briefly note Manacher's algorithm can solve this in O(n) time, but it's more complex; expand-around-center is usually preferred for interviews unless O(n) is explicitly required.

Key Points to Mention

  • Definition of palindrome and substring (contiguous sequence).
  • Duplicates at different positions are counted as separate substrings.
  • Expand-around-center technique: odd-length (center at char) and even-length (center between chars).
  • Time complexity O(n^2) and space O(1) for expand-around-center.
  • Edge cases: empty string, single character, all identical characters.
  • Manacher's algorithm as an O(n) alternative, with trade-off of complexity.

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