InterviewLegend

Strings and Palindromes

Alex Chen25 min readUpdated 33 real interview reports

String questions at Amex stay short. US entry-level and intern screens tend to ask for a quick palindrome question in Java. SDE rounds in India have gone a step further, with substring problems that need a window or an expanding center. All three fit on one screen, and each can still fail on an index.

The three build on each other. In the first, two indices move toward the middle. Next comes a window that slides to the right and remembers where each character last appeared. For the last one you turn the first idea inside out and grow outward from every center. If you can explain the bounds on each loop, you can explain all three.

The American Express angle
Amex string rounds run in Java, in an editor that won't run your code. Every index bound is on you. Calling charAt one past the end throws StringIndexOutOfBoundsException, and substring(lo, hi) stops one short of hi. Expect a JVM question or two mid-problem, such as what garbage your loop leaves for the collector. Answer it from the code on your screen, then get back to the loop.

American ExpressPremium lesson · Coding round

The 3 American Express problems are below.

  1. A Premium questionCoding · Easy
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

Each with hints, the follow-up and a tested solution.

Get the American Express questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your American Express interview?Tell us what they asked. Reviewed before it goes in, never with your name.
American Express interview guide

Know what American Express asks before you walk in.

30 coding · 3 system design · 15 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.