1
Developer's Corner / Re: Facebook Programming Puzzles (Solve and Get Hired)
« on: December 12, 2010, 05:11 PM »
A coworker mentioned these puzzles to me last week, I took on 'liarliar' in C++, spent half an hour coming up with a sub-50-line program that solved it (conciseness was my goal), submitted it, got back a response that it passed all their tests, taking 1610.652ms on the longest test case.
I then tried to see how well that time compared to other solutions. There is a discussion about just that here:
http://www.facebook....4266&topic=14834
and seeing some impressive times for 'liarliar' there I set out to code a more optimized solution (in C this time). After a few hours of work, spread out over a few evenings, I got one I was satisfied with, it ran nearly 15X faster than my C++ version on some very large programmatically-generated test cases. Submitted that last night and got back this morning that it passed all their tests and took 423.313ms on the longest test case. Not the 15X I was hoping for but I'll take it . . . but it leaves me wondering how the times claimed to be around 110ms were achieved.
Anybody else have any times to share?
I then tried to see how well that time compared to other solutions. There is a discussion about just that here:
http://www.facebook....4266&topic=14834
and seeing some impressive times for 'liarliar' there I set out to code a more optimized solution (in C this time). After a few hours of work, spread out over a few evenings, I got one I was satisfied with, it ran nearly 15X faster than my C++ version on some very large programmatically-generated test cases. Submitted that last night and got back this morning that it passed all their tests and took 423.313ms on the longest test case. Not the 15X I was hoping for but I'll take it . . . but it leaves me wondering how the times claimed to be around 110ms were achieved.
Anybody else have any times to share?