LINQ is one of my favorite interview topics for many reasons. It allows me to check a candidate’s ability to define logic, use SQL skills, showcase lambda expressions, distill the problem into easy steps and of course, see some code in action. Also, since LINQ code is generally quite compact, it is perfect for white boarding.
I was recently helping a friend solve a problem and felt that it could be modified to an excellent interview question. It has a bit of algorithm design, heavy use of simple to medium complex LINQ and is not more that 10-15 lines of actual code. Perfect.
Question: Given a class of students (ID, Name, Grades) with results for at least 2 semesters, find the students whose Grades have significantly improved in the second semester as compared to the first. Bonus: List out top 25% of the students.
To read the algorithm and see the entire code solution go to my programming interviews blog at http://www.programminginterviews.info/2013/04/linq-design-interview-question.html