Microsoft Interview Question for Software Engineer in Tests






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

If the question is: "Get the first character from s1 that is repeated in s2." (otherwise, reformulate the question and/or give a sample), then:
-Assume ASCII.
-Create a array a[128] where you set the frequency of the characters from s2.
-For every char in s1, check if the frequency is >= 2.
-O(n+m)

- S January 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

1- Create a hash table.
2- Insert each char of S1 in the hash table.
3- Iterate every char in S2. If that char is in the hash table return the index.
If the index ==strlen(S2) return -1;//Not found

The order of checking an element in the hashtable is O(1) therefore the order of the function is O(n)

- Anonymous December 27, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Create a new string S3 = S1 + S2;
2. Iterate through char in S3;
3. Find index of each char from S3 in S2 and S3.
4. If index from S2 is !=1 && 2 index are not same them return that character.

- pritam83 March 12, 2011 | 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