Microsoft Interview Question for Software Engineer in Tests






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

do not assume that "space" is the only delimiter????

Means you dont have any extra space or what ?

- Ratn October 11, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it may mean that we may have other punctuation marks like . or , as delimiters. The idea sud be to take any non alphanumeric value as delimiter

- Anonymous October 11, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

For the reversal question, it can be done in-place with a running time of O(nm) where n is the average number of characters in a word and m is the number of words in the sentence.
Loop through the characters, if the char is a delimiter, reverse the word till that point. Repeat the reversal at the end of the word. (Since there will be no delimiter at the end of the sentence)

For the random problem, convert the two dates to TotalMilliseconds.
Then do
(GetRandom() % (EndDate - StartDate)) + StartDate

This will give a random date between StartDate and EndDate.
Here, we assume that GetRandom() returns a random, unsigned long.

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

DateTime d1 = new DateTime(2004, 02, 23);
DateTime d2 = new DateTime(2008, 06, 20);
Random r = new Random();
System.TimeSpan diff = (d2 - d1);
double milli = diff.TotalMilliseconds;
double rand = r.NextDouble() * milli;
DateTime d3 = new DateTime(d1.Year,d1.Month,d1.Day);
d3 = d1 + TimeSpan.FromMilliseconds(rand);
Console.WriteLine(d3);

- Anonymous November 11, 2008 | 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