MM
BAN USER
- 2of 2 votes
AnswersWrite a program to shuffle a deck of card?
- MM in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - 0of 0 votes
AnswersSuppose you have a stock broker events that send events whenever there is an event occurs, like buy, sell etc.
- MM in United States
There are apps that needs gets these data from the events application, not all application needs all the functions.
There is broker interface that is a link between the apps and the stock application. How will you design the classes, methods etc.| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - 1of 3 votes
AnswersA message containing letters from A-Z is being encoded to numbers using the following mapping:
- MM in United States
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total number of ways to decode it.
For example,
Given encoded message "12", it could be decoded as "AB" (1 2) or "L" (12).| Report Duplicate | Flag | PURGE
SDE-2 Algorithm - 0of 0 votes
AnswersSuppose you have a matrix in the form of a 2 dimensional array. Write a method to read the rows of the matrix alternatively from right to left, left to right so on and return them as a 1 dimensional array.
- MM in United States
for eg:
1 2 3
4 5 6
7 8 9
should return 1 2 3 6 5 4 7 8 9| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswerWrite a function that takes a string of javascript code as parameter and returns a new string with these literals standardized on double quotes.
- MM in United States
For example if the input is
/* This method says 'hello'*/
function sayHello()
{alert('hello')}
The out put should be
/* This method says 'hello'*/
function sayHello()
{alert("hello")}
The quoted text in the code section of the function should be changed to double quotes. The quotes used in the comments section should be left alone.
static string standardizeJavaScript(string inputJavaScript)
{
string temp = string.Empty;
if (string.IsNullOrEmpty(inputJavaScript))
return inputJavaScript;
bool updateQuote = false;
string output = string.Empty;
string[] split = inputJavaScript.Split('\n');
for (int i = 0; i < split.Length; i++)
{
if (split[i].Contains("{"))
updateQuote = true;
//if (split[i].Contains("{"))
// updateQuote = false;
if (updateQuote)
{
split[i] = split[i].Replace("'", "\"");
output = output +"\n" + (split[i]);
}
}
return output;
}| Report Duplicate | Flag | PURGE
First Orion SDE1 - 0of 0 votes
AnswersWrite a function that will give the number of intersections between 2 strings. The function should take two string parameters which represents 2 words that may or may not intersect.The method should return the count of intersections which are found. For example, if the input is word 1 - Sales, word 2 - isles. The out put should be 4.
The word sales and isle intersects in 4 places.
1. The 2nd letter of isle intersects with the 1st letter of sales.
2. The 2nd letter of isle intersects with the 5th letter of sales.
3. The 3rd letter of isle intersects with the 3rd letter of sales.
4. The 4th letter of isle intersects with the 4th letter of sales.
- MM in United Statesstatic int numberOfIntersections(string word1, string word2) { if (string.IsNullOrEmpty(word1) || string.IsNullOrEmpty(word2)) return 0; string shorterWord = string.Empty; string longerWord = string.Empty; //Identify the shorter word and the longer word if (word1.Length < word2.Length) { shorterWord = word1.Trim(); longerWord = word2.Trim(); } else { shorterWord = word2.Trim(); longerWord = word1.Trim(); } //Create a dictionary with the characters of the shorter word Dictionary<char, int> lookup = new Dictionary<char, int>(); Dictionary<char, int> duplicates = new Dictionary<char, int>(); foreach (char c in shorterWord) { if (!lookup.ContainsKey(c)) lookup.Add(c, 0); else { if (!duplicates.ContainsKey(c)) duplicates.Add(c, 1); else duplicates[c] += 1; } } //update the count of characters if the character is present in the longer word foreach (char c in longerWord) { if (lookup.ContainsKey(c)) { lookup[c] += 1; } } //get the count of letters that has value greater than 0 var totalCount = lookup.Sum(l => l.Value); int dupCount =0; //get the letters that are common and have duplicates foreach(KeyValuePair<char,int> d in duplicates) { if(lookup[d.Key] > 0) { dupCount += (lookup[d.Key] * duplicates[d.Key]); } } return totalCount + dupCount; }
| Report Duplicate | Flag | PURGE
First Orion SDE1 - 0of 0 votes
AnswersSuppose you have an array with infinite numbers, which is sorted and there may be duplicates. Find the occurrence of a number.
- MM in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersHow will implement an auto complete feature? Eg: if you type clo it shows clothes etc
- MM in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - -1of 1 vote
AnswersN Queens problem
- MM in United States| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersWrite the code to detect when a winning pattern is present in a board.
- MM in United States| Report Duplicate | Flag | PURGE
Development Support Engineer Algorithm - 0of 0 votes
AnswersWrite a function to convert an Integer representing a number of bytes (less than or equal to 1 Gigabyte) into an easy to read format, defined as follows: • Maximum of 3 digits (not counting a decimal point), and a single letter to signify the unit of measure. • No leading zeroes, or trailing zeroes after a decimal point. • Be as accurate as possible.
- MM in United States
Maximum of 3 digits (not counting a decimal point), and a single letter to signify the unit of measure. • Round to the nearest valid values. Examples: o 341 = 341B o 34200 = 34.2K o 5910000 = 5.91M o 1000000000 = 1G • No leading zeroes, or trailing zeroes after a decimal point. Examples: o 34K, not 034K o 7.2M, not 7.20M • Be as accurate as possible. Example: o 54123B = 54.1K, not 54K • Note: For this problem, 1000 bytes = 1 KB, and so on| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersSuppose you have a collection of collection
- MM in United States
Eg : CEO-> Vps-> GMs ->..
CEO will contain collection of VP's, VP's will have collection of GM's and so on.
Suppose you need to find a particular GM is the alias is given. Write a linq query to get the employee details if the employee alias is given.
Hint : Use Recursion + Linq| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Software Development Manager - 0of 0 votes
AnswersSuppose you get number of unique users every second from bing
- MM in United States
For eg, 2,4,5,1,2,etc
You need to write a web service method , such that it takes the input n, which return lowest n unique number from the list of unique numbers. For eg, if n is 3 then you need to return 2,1,2| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer
Repcoragkemmer, Data Scientist at Bankbazaar
Have years of experience to treating variety of outpatients with modalities such as massage, exercise, paraffin, joint mobilization, mechanical traction ...
But since it is an infinite array, how do you find the right most?
- MM February 20, 2015