Interview Question


Country: United States




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

What company? Phone or onsite?

- Anonymous November 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{
ListVals LstItmLstItm = new ListVals();

List<ListVals> TheSource = new List<ListVals>();

AddToNode("2", "a", TheSource);
AddToNode("4", "c", TheSource);
AddToNode("6", "e", TheSource);
AddToNode("2", "b", TheSource);
AddToNode("4", "d", TheSource);
AddToNode("6", "f", TheSource);


var JustNodes = (from ListVals in TheSource
select new
{
NodeOnly = ListVals.NodeId.ToString()
}
).Distinct().AsEnumerable().ToList();

var MatchedNodes = (from NdGrp in JustNodes
join LstItm in TheSource on NdGrp.NodeOnly equals LstItm.NodeId

select new
{
NodeKey = NdGrp.NodeOnly.ToString(),
NodeVals = LstItm.NodeVal.ToString()
});


foreach (var NodeEntry in MatchedNodes)
{
Console.WriteLine(" Node = " + NodeEntry.NodeKey.ToString() + ", Value = " + NodeEntry.NodeVals.ToString());
}
string Inkey = Console.ReadKey().ToString();
}

static void AddToNode(string NodeKey, string NodeVals, List<ListVals>TheStack)
{
ListVals ListItem = new ListVals();
ListItem.NodeId = NodeKey;
ListItem.NodeVal = NodeVals;

TheStack.Add(ListItem);
}
}

public class ListVals
{
public string NodeId { get; set; }
public string NodeVal { get; set; }
}
}

- Woody November 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This _easy_ thus must be _homework_.
Stop spamming!
I am not going to waste 30 seconds to solve this _dumbfuck_ question.

- Urik November 23, 2013 | 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