Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: What is the minimum number of character replacements needed to make "abcdba" a palindrome?

  1. A. 2
  2. B. 1
  3. C. 0
  4. D. 3

Correct answer: B. 1

Each mismatched mirror pair needs exactly one replacement, and matched pairs need none. The mirror pairs here are (a,a), (b,b) and (c,d), so the answer is one.

More Coding Interview Problems questions

Exams that ask this topic