Interview Of An Indian Top Coder : Rudradev Basak
When I (Anil Kishore) started taking part in algorithmic programming contests, for more than two years, it was just me, lot of problems, very few algorithms, my ideas and my Java codes. With that, I would have probably been still a green rated coder, working for a software company in Bangalore after moving between two or three places, still in search of the right things to do. But why ? Problems, Algorithms, my Ideas and my Codes.. what else I need ? This is where many Indian coders make mistake. Almost two years after joining TopCoder (TC), I started interacting with fellow coders, knowing more about them, reading lots of others codes, being active in forums and part of the wonderful community. That was the crucial part of my career so far. TC has some interviews of foreign coders and they are very interesting to read. Knowing more about our own Indian coders will be more fun, especially for beginners to get inspired. This is the least I can contribute to the wonderful community that has given a strong foundation to my career, introduced to me some amazing people around the world.
( This post is for coders, especially Indian coders. If you are not a TopCoder member or not interested in algorithm / programming / math contests, this may not be very interesting to you. )
This is the first interview post in this blog and no prizes for guessing correctly whom it is with ( because you read the title already ;) ). This interview is with Rudradev Basak, or should I say rudradevbasak , also known as Rudy. He is undoubtedly one of the best Indian coders of all time and is currently leading the Indian rank list in TopCoder, CodeForces, CodeChef. He is also part of the team Proof of IIT-Delhi along with Nikhil and Pradeep, that won ACM-ICPC Asia Amritapuri regionals 2011-12. They will be representing IIT-Delhi this year ( second time in a row ) at the ACM-ICPC World Finals 2012, Warsaw, Poland. So, lets find out more about Rudy, his way of competing and more.
Tell us about yourself and your schooling
I was born in Burnpur, near the city of Asansol in West Bengal. I attended St. Vincents School in Asansol, a highly disciplined school run by the Christian Brothers. For +2, I shifted to another school, named BRS (Burnpur Riverside School). There I qualified within top 30 of INMO(Indian National Maths Olympiad), and that was a pretty big thing for my school at the time. (I had qualified the RMO for the last two years, but could not manage to qualify INMO) The headmaster gave me leave to study for IIT-JEE, and not come to school at all :P. Anyway I attended the IMOTC(International Maths Olympiad Training Camp) for 2 consecutive years, and also was a part of the Indian IMO Team in 2008, and that was an extremely enlightening experience for me. It was at the camp, that I was given the nickname Rudy, which has stuck till this day. Also I managed to get into the CS Department at IIT Delhi, and met an entire bunch of awesome and brilliant people.
How did you get in to algorithms, problem solving and competitive programming ?
In IIT Delhi, the first couple of semesters had a basic intro to CS course, and a Data Structures Course. At that time I did discuss algorithmic problems with friends once in a while, but I did not go into competitive programming at all, even though I had heard about TopCoder. In my fourth semester (Jan-May 2010), I had the course CSL356 - Analysis and Design of Algorithms. And one day, I happened to see a fellow student, Jatin Batra, doing Topcoder in the institute lab. I went up to him, and saw that, contrary to my preconceptions about Topcoder problems, the problem he was solving was quite doable. That was the moment that got me into doing TC and into competitive programming in general. I had a good first match, catapulting me to Div1, and since then I have been pretty addicted to it. It helped that in the summer of 2010, I was at the institute doing a summer project, but still had plenty of free time. I also got into doing TC Marathons at that time, which I think has at least helped my implementation skills.
When did you start preparing for ACM-ICPC and how did you practice for it ?
Pradeep, Rudradev, Nikhil at the 2011 ACM-ICPC World Finals
My topcoder participation also galvanized my teammates, Nikhil Garg and Pradeep Mathias, to become more active in coding. And in the next semester (Aug-Dec 2010), we decided to try out for ICPC. We started practice slowly, barely meeting once in a couple of weeks at first, but later accelerated a lot. We learned an awful lot from each other, and in that November/December, I remember us practicing in a frenzy, especially in the 14 day gap between the end of Major exams and the Amritapuri Regionals. Each of us routinely crossed 12 hours a day in coding, both individual and team practice. That was a level of dedication and hard work we would never match again in the future.
The hard work paid off, as we came 2nd at the Amritapuri Regionals, and to this day, that remains my most satisfying moment in my contest career. Since then, we have done sporadic practice, sometimes going weeks without doing any, and sometimes gathering enough motivation to get into a pretty rigorous routine. I have still tried my best to do as many contests as possible, and maintain a medium level of practice, as far as my mood will allow. And I hope that this time, we will perform well in the ICPC World Finals, happening in Warsaw in 4 days time.
Many Indian coders admire you. Who are some coders whom you admire ?
There are a lot of coders I admire. I remember meeting Venkatesh Basker in Amritapuri Regionals 2010, and he gave us a lot of encouragement. Ajay Somani and Varun Jalan were also idols to me. Besides of course, I admire all the targets and almost-targets, those geniuses from around the world.
What is your strategy during TopCoder algorithm matches ?
Like most I open the 250 point problem first. For me, nowadays, aim is to solve 250 in < 10 mins, and faster if possible. So I try to read the question as fast as possible. While midway through reading the question, I try to guess what is the quantity that the problem is going to ask from me. And I get it right a considerable fraction of time. Parallelly ideas start forming to solve the problem. I generally try to avoid reading the example test cases before coding (unless the problem statement was really complex and I needed some clearing up). I find that they often misdirect my thoughts in weird directions. Type as fast as I can, and hit Compile. Number of times I hit Compile Error on 250 pointer before getting it to run is on average I think around 1 in recent months. If examples passed, then glance through the examples for the first time, glance through the code once, and Submit! If not passed, then I actually try to read the sample test cases properly, and go on about debugging the code. In any case, after I submit, I look at the division summary for the first time, (unless I haven't been able to solve the 250 in say 15 mins). In cases where I submit immediately on passing examples, I generally spend a couple of minutes more trying to check and recheck stuff. I think it has helped me to correct mistakes twice in recent past. Although Reading speed isn't that important, I still think people should try to improve in that area, in general, and not only for topcoder purposes.
Solving the 250 gives me an adrenaline rush unlike anything else (except maybe the first couple of minutes in challenge phase, and the split-second wait after you submit a challenge). Once I decide to open the 500, things calm down a lot. I try not to look at the Division Summary too often. In fact, I have noticed that if I am not getting ideas in the 500, then checking the division summary seems to make it worse. So I have made it a point nowadays not to look at the Division Summary at all within 30 minutes after opening the 500.
You seem to have gained some points from challenges these days, what did you change ?
If in the last few minutes of the coding period, if I see that I have virtually no chance of completing another problem, I switch to test case generation mode. Up until a few matches ago, I was very poor at challenging (I had total career challenge points negative !). In recent matches I've been able to sneak in a few challenges here and there. Often I fixate on a few plausible bugs that others might have left in their code, and only focus on those issues in the first 5 minutes of challenge phase. Later I switch to random solution mode. Finding a bug, creating a test case, clicking challenge, and waiting for that split second before the verdict is, as anyone who has experienced it will agree, a breathtaking experience.
What is the role of elegance and simplicity of code in short contests ?
Even though in the short run, writing code fast, and writing elegant/simple code, may seem to be conflicting, I believe that in the long run, maintaining simplicity of code and elegance of solutions is very much in line with writing fast and correct code. Of course it may not seem easy at first, but practicing and making it a habit of writing code elegantly will definitely help.
Do you listen to music while competing ?
I tried solving SRMs while listening to music a couple of times, but it didn't turn out very good for me. However I do like to listen to some calming music in the 10 minutes right before the match starts. I have found that this calming helps me to maintain a more vigorous attitude during solving the 250 later on.
What are some current milestones you want to reach in coding contests ?
Getting to the onsite finals of Topcoder Open and Google Code Jam are some milestones I would really love to reach.
Finally, what advice do you give to different levels of coders ?
First, before I advise people to practice harder, I want to say, "Practice ONLY if you actually enjoy it/want to do it. There is no point in practicing just for the sake of some vague goal in the future which you may or may not attain." Now, the only advice I can give to people, is to practice!. On topcoder, grays and greens need to learn implementation skills, and to convert their thought process into code efficiently, and NOT learn up algorithms. Once one progresses to higher green, or blue, then you need to actually start learning algorithms. For higher rated people, identifying your weak points, improving your accuracy, and MORE practice should help :) Also, for all people, reading code of other higher rated coders will always be helpful.
Lets thank Rudy for taking his time in replying to my questions and wish him all the best for his career. Hope to see him as a TC target soon and wish his team good luck in World Finals this week, and beat the previous best Indian rank : 29. Lets also wish other Indian teams in ACM-ICPC World Finals in Poland this week, all the very best, especially the team TuringMachine ( Anish, Kunal and Nadeem ) of IIIT-Hyderabad ;). Make us proud guys !