1.

Consider the string “efge”. What is the minimum number of insertions required to make the string a palindrome?(a) 0(b) 1(c) 2(d) 3This question was addressed to me in an interview.Enquiry is from Minimum Insertions to form a Palindrome in chapter Dynamic Programming of Data Structures & Algorithms II

Answer»

The ANSWER is: 1

 The string can be converted to “efgfe” by INSERTING “f” or to “egfge” by inserting “g”. Thus, only ONE insertion is REQUIRED.



Discussion

No Comment Found

Related InterviewSolutions