Microsoft Interview Question






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

Hash the first char array which will take into account number of occurrence of every character.
Hash the second char array. and reduce the value of hash{character} by 1.
Iterate thru the entire hash and if any negative value occurs then return false else true.

- Dpac May 09, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use a bit vector. Increment/Decrement stuff.

- knap May 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

bit vector is a better option...which you can use off the shelf...

- nerd July 14, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

bit vector is a better option...which you can use off the shelf...

- nerd July 14, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use counting sort (O(n)) and then run length encoding into string O(n) and string compare each sting O(n). hence O(3n) equal to O(n).

- wat abt August 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use counting sort (O(n)) and then run length encoding into string O(n) and string compare each sting O(n). hence O(3n) equal to O(n).

- wat abt August 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use counting sort (O(n)) and then run length encoding into string O(n) and string compare each sting O(n). hence O(3n) equal to O(n).

- wat abt August 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@ nerd and @ wat abt on August 11, 2009
repeating your answer 3 times does not mean it is THE answer, so do not do that please. thank you !

- xinhua.liu@yahoo.co.cn October 02, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Initialize an array of 256 integers to 0.
Traverse pa and populate array with count of each character.
Traverse pb:
For each character in pb:
If count of the character is <=0 return false
Else decrement count of the character in the temp array.
return true

- Rob March 08, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Initialize an array of 256 integers to 0.
Traverse pa and populate array with count of each character.
Traverse pb:
For each character in pb:
If count of the character is <=0 return false
Else decrement count of the character in the temp array.
return true

- Rob March 08, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Initialize an array of 256 integers to 0.
Traverse pa and populate array with count of each character.
Traverse pb:
For each character in pb:
If count of the character is <=0 return false
Else decrement count of the character in the temp array.
return true

- Rob March 08, 2010 | 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