Apple First round Interview question

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2021-05-23Added By Anonymous
Source: Link

Given a string word, count the number of characters that needs to be added to word to make it anadrome - a string which is an anagram of some palindrome.


For example, if word = "tattoo", its possible to add a single letter 'a' to make it an andarome "tattoa", letters can be rearranged to become "aottoa", which is a palindrome.


Other examples:

Input : "abcb"

we can add either 'a' or 'c' to make it anadrome.

Output:1


Input: "abab"

Output :0


Input: "abc"

output: 2

Comments