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 posed to me in an international level competition.The question is from Minimum Insertions to form a Palindrome topic in portion Dynamic Programming of Data Structures & Algorithms II

Answer»

Right option is (b) 1

Explanation: 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