Microsoft Interview Question
1,274 Interview Reviews |
Back to all Microsoft Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Development Engineer In Test (SDET) at Microsoft:
Write a method (in a language that you are comfortable with) that determines whether one given string is a substring of another given string.
See more for this Microsoft Software Development Engineer In Test (SDET) Interview
Helpful Question?
Yes |
No
Inappropriate?



0 of 0 people found this helpful
by Interview Candidate:
S2 = the string to check in S1
I did this in O(n) time by reevaluating S2 while walking through S1 one time. So, start at the first character of S1, and check whether this is the first character of S2, then the second character and so on. If they are the same until S2.length, then it is a substring, if not start over with the first character of S2 and keep going.