Microsoft Interview Question for Software Engineer in Tests






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

counting sort

- asuran October 14, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can use hash technique. This works for ASCII characters. There are 256 of them. So intitialize an int arr of 5 to 255 to 0. Hash the characters based on their ASCII values. Keep incrementing the counts in the array. Hash them again to find the max character count.

- Sadineni.Venkat October 29, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Correction: So intitialize an int arr of 0 to 255 to 0.

- Sadineni.Venkat October 29, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can u list the testcases which you mentioned ?

- sat March 25, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Using a hash technique..

int maxcount(string str){
	map<char,int> matches;
	if(str.size()<=0)
		return 0;
	int max=1;
	for(int i=0;i<str.size();++i){
		if(matches.find(str[i]) == matches.end()){
			matches.insert(pair<char,int>(str[i],1));
		}
		else 
		{
			matches.find(str[i])->second++;
			if(max<matches.find(str[i])->second)
				max=matches.find(str[i])->second;
		}
	}
	return max;
}

Test cases which actually recovered bugs for me
Input- output
aabbaac - 4
abcabc - 2
-0//null string
a- 1
123ab2- 2
^^^cd12- 3
Aabbb- 3

- prolificcoder April 19, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

suffix tree

- Bangxin May 13, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Can you please explain?

- russoue February 05, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

binary search tree.

use inorder traversal to sort

- kk October 10, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int hash(char c){
  return c - 65;
}

int retMaxCount(char *str){

    int hashmap[255] = { 0 };
    int i = 0;
    while ( *(str + i) != '\0' ){
       hashmap[hash(str+i)]++; 
    }
    
    int n = -1;
    while ( i < 255 ){
      if ( n < hashmap[i]) {
          n = hashmap[i]; 
       }
     }
   return n;
}

- Anonymous November 23, 2009 | Flag Reply


Add a Comment
Name:

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

Books

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

Videos

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