What InterviewStreet taught me after I spent a few hours with it
I have known about InterviewStreet and what they do for a long time now, but never took the time to actually go through their challenges. Last night, around 11.30 P.M., I was feeling bored and was randomly browsing when I stumbled upon InterviewStreet again and decided to give their challenges a try. Because of my bored, sleepy state, I joined InterviewStreet using my Facebook login and chose one of the 50 points problems. I coded the solution in Java in a sleepy manner and when I uploaded it, my first shock came when I saw that my solution compiled successfully. I never expected it to run because of the off-hand manner with which I coded it. Then I submitted it and to my astonishment, it cleared 9⁄15 test cases. Then I woke up and started working, actually working on that problem. I usually write User-Friendly code, that practically spoon feeds the user what they have to do, so my programs involve a lot of I/O operations. Sometimes when I write System-friendly programs, I simply remove the unwanted I/O Statements. That’s how I had coded this one too. As minimal I/O statements as possible. I made a small change and removed an empty output statement and my solution managed 10⁄15 test cases. That is all it did. Try as I might, I was not able to take it past that 10. Though my first attempt was a failure, I learnt an important lesson today. Friendly though my programs may be, easier-to-understand they may be, but they’re not Optimized. I learnt that my codes lack optimization and optimization is more than just getting rid of the I/O statements so as to reduce the overhead.
InterviewStreet has made one thing clear for me. That I have to learn Code Optimization seriously and try to improvise my style to make my codes optimal.
Thanks to InterviewStreet, I had a very productive night where I forgot even the pain of my Typhoid fever and sat and coded feverishly, my mind on nothing but the problem(s) at hand and the solution for them. It’s been a long time since I dedicated myself like this. It’s InterviewStreet that made me do this and am much grateful for that.
Now, Code Optimization has been included into my Agenda for 2012 !
Adios amigos, until the next post then…