McAfee Interview Question for Applications Developers

Country: United States

Comment hidden because of low score. Click to expand.
of 1 vote

1. You can make use of a Hashmap for each string. Each line is a string. Use a hashmap to count all the characters. If the length is odd, 1 character can appear once, rest all have to appear or the count has to be even for other characters. The characters that fall short of this condition are the number of characters required to make the string a palindrome. The you can just go over the hashmap, use two pointers front and rear to place the elements. Time complexity O(n) for the lines, O(T) for each string, So O(Tn) for the file containing all the strings.
2. Sort the string and count the characters. Follow similar approach as in case 1.
Time complexity O(n) for lines, O(TlogT) for sorting. O(nTlogT) in total.

- WilOzil November 26, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
of 1 vote

// ZoomBA
def count_more_char( string  ){
  m = mset ( string.value )
  // find all chars with odd frequency 
  odds = select ( m ) :: { $.o.value % 2 != 0 }
  len = size(odds)
  // every char freq is even means 
  //can be shuffled into a palindrome
  if ( 0 == len ) return 0  
  // because only one odd freq can be allowed 
  //for palindrome, rest needs to be made into even 
  len - 1  

Based on expansion of WilOzil's idea.

- NoOne October 09, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
of 1 vote

first you can maked any app

- jacky June 21, 2015 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More