Purushotham Kumar
BAN USER- 0of 4 votes
AnswersYou have been given a series of 'n' numbers and the series is in a random order. Write a program to find the median of the series with minimum complexity.
- Purushotham Kumar in Canada for Graduate Recruitement Team| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Java - 2of 2 votes
AnswersThe object of this exercise is to fix 3 known issue with the existing code, and add a new feature to the tool.
- Purushotham Kumar in Ireland for CPL Recruitment Team @Microsoft
The known issues to address are:
· The current implementation of the tool incorrectly ignores white space (spaces and tabs) between words, which is a bug. Modify the code so that white space differences are correctly detected
· Tool doesn't report difference if second file is larger than first file
· For large input files the tool consumes considerable RAM. Modify tool to address this performance bug
The new feature to implement is:
· Add a new command line switch -i and functionality to allow case-insensitive comparison
Running the tool requires you to supply 2 command line arguments – these will be the paths to 2 text files that should be compared. You are responsible for creating this test data.
/*
* New Requirement:
* - Add a new command line switch -i and functionality to allow case-insensitive comparison.
*
* Issues to fix:
* - The current implementation of the tool incorrectly ignores white space (spaces and tabs) between words, which is a bug.
* Modify the code so that all white space differences are correctly detected and reported along with differences in words.
* - Tool doesn't report difference if second file is larger than first file.
* - For large input files the tool consumes considerable RAM. Modify tool to address this performance bug.
*
* Please ensure you include all test files that you create for each of your test cases along with your submission.
*/
namespace CsDiff
{
using System;
using System.Collections.Generic;
using System.IO;
class Program
{
static void Main(string[] args)
{
if (!ProcessArgs(args))
{
return;
}
using (FileReader sourceFile = new FileReader(args[0]))
using (FileReader targetFile = new FileReader(args[1]))
{
IEnumerator<string> sourceEnum = sourceFile.Words.GetEnumerator();
IEnumerator<string> targetEnum = targetFile.Words.GetEnumerator();
for (int word = 1; sourceEnum.MoveNext() && targetEnum.MoveNext(); word++)
{
if (sourceEnum.Current != targetEnum.Current)
{
Console.WriteLine("Difference at position {0}: '{1}' different to '{2}'",word,sourceEnum.Current, targetEnum.Current);
}
}
}
}
static bool ProcessArgs(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine("Please specify [source] and [target] file paths");
return false;
}
for (int arg = 0; arg <= 1; arg++)
{
if (String.IsNullOrEmpty(args[arg]) || !File.Exists(args[arg]))
{
Console.WriteLine("File '{0}' not found", args[arg]);
return false;
}
}
return true;
}
}
public class FileReader : IDisposable
{
string[] words;
public FileReader(string path)
{
string fileData = File.ReadAllText(path);
words = fileData.Split(new char[] { ' ', '\t' });
}
public IEnumerable<string> Words
{
get
{
return this.words;
}
}
public void Dispose()
{
}
}
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 0of 0 votes
AnswersDesign class structure for a building, floors and space. The space can be an apartment, a store or an office. Include any properties, fields and methods you think would be interesting to have.
- Purushotham Kumar in Ireland for Microsoft Ireland intern recruitment team| Report Duplicate | Flag | PURGE
Microsoft Intern - 13of 19 votes
AnswersWrite a program to find whether a given number is a perfect square or not. You can only use addition and subtraction operation to find a solution with min. complexity.
- Purushotham Kumar in Ireland
i/p : 25
o/p : True
i/p : 44
o/p: False| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test
why to go with array. instead of array you can take hashtable and run the loop till the length of the string.. I guess interview just trying to confuse you.. Here you just need to return only the first non repeat character. in whatever language you take input just run the code till the length of the string and return first non repeat character.
- Purushotham Kumar June 10, 2013
Repaanyagill, café manager at The Best Cafe
Unshakable dedication to bringing out the best in a restaurant and its employees, while taking exemplary care of guests and ...
Repcharlesndouglass, Employee at VANS
I am Michael from Nantucket USA. I am working as a Power plant dispatcher in Matrix Design company. I am ...
RepEdithJHarden, Random at Axiom Sources
Je suis un professionnel de la gestion des soins de santé avec 2 ans d'expérience en supervision d'établissements ...
RepRobertBaumbach, Administrative Manager at Meridian Mechanical Services
Repshirleyjbarker439, Animator at ASAPInfosystemsPvtLtd
Hello, I am Gladys. I am a Industrial Photographer. I started off my photographic career as a News photographer based ...
Repprishamondel, Quality Assurance Engineer at Bloomberg LP
I am Prisha, a versatile self-starter and a quick learner looking for a position within your company, Netaid. My hobbies ...
Repkiyanshak, Associate at Adobe
I am a skilled software developer and have 5 years experience as a data coder operator. I have certain skills ...
Repkennypmillerk, AT&T Customer service email at 247quickbookshelp
My name is Kenny and I am working as a trusted investor in Pittsburgh USA.I identify / set up a ...
this solution has greater complexity. but the solution required should have min complexity
- Purushotham Kumar June 12, 2013