Microsoft Interview Question
1,273 Interview Reviews |
Back to all Microsoft Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Development Engineer Intern at Microsoft:
Reveres all the words in a string before you encounter a word which has 'x' in it. Hi, I like Microsoft asdfxab Settle -> Microsoft like I Hi, asdfxab seattle.
See more for this Microsoft Software Development Engineer Intern Interview
Helpful Question?
Yes |
No
Inappropriate?



1 of 2 people found this helpful
by andrejev2006:
using System.Linq;
namespace ReverseWords
{
class Program
{
static void Main()
{
const string inputStr = "Hi, I like Microsoft asdfxab Settle";
string reversedStr = String.Join(" ", inputStr.Split(' ').TakeWhile(n => !n.Contains("x")).Reverse());
string resultStr = String.Concat(reversedStr, inputStr.Substring(reversedStr.Length));
Console.WriteLine(resultStr);
}
}
}