class TimeObject
{
DateTime time;
bool isMatinee;
}
Given: {8:00, 9:30, 11:00, 12:10, 2:00, 4:00, 5:20} -- a collection of TimeObjects
Output: (8:00AM, 9:30, 11:00, 12:10PM, 2:00), 4:00, 5:20 -- return a string, oh and AM/PM should be picked up from localization strings
Caveats: AM/PM only shown for first time, ( ) encloses those elements whose matinee bool was set to true.
Question is: I have to figure out how to output the above string.
I mentioned, I knew C#, the interviewer was adamant to know how to do this in the fewest lines of readable code, preferably using LINQ. He said, I could write it to the console, but I had to remember to localize the AM and PM.
I obviously created a bunch of temp collections, and crap, and totally botched it up. He claims that it's only a few lines of LINQ. I tried other things, though he kept steering me towards LINQ.
Help? Any body has ideas? This has really been cringing me the whole day now.
UPDATE - I GOT THE JOB! They also asked me Edit distance {HELLO} --> {HLO}, tell the min. number of edits/updates it'll take to get to the final string. And there are Bees, And Honey in the world, there is 1 queen bee, the only way the honey can be accessed is through the Queen. Construct a make belief computer world that can support this, and tell if the world is in violation or not -- Graph, Root node is Queen Bee, Nodes are Honey and Bee, Run BiPartite test to see if world is in violation.