Online Judge

Practice your coding skills


04 Feb 2017 View Comments
#online #judges #programming #coding #computer

Online Judge systems are web spaces where programmers can practice their programming skills. System can compile and execute code in most of the modern languages. Online Judge systems are useful for the two reasons in my opinion:

  1. Programming contest.
    Online Judge systems are initially built for one purpose: contest. I never ran through a coding contest before. Although I am agaisnt the word competition in general, a coding competition actually sounds quite interesting except there is an inevitable competing factor, though. I saw 4-hour video of Gennady Korotkevich who won 2016 Google Code Jam last year. When I first came across the video, it really blew my mind. It was literally a cultural shock to me. He would just read over the questions on average about 5 minutes for each problem and then dive right into coding which appeared he was coding in C++ in the video. Watch it when you have time available. I didn’t watch the full 4 hours but even with skimming through, it was still blazingly fast how he is coding overall. However, just as you should know, coding fast doesn’t make you a professional programmer, at least that is my belief. To me, deep thoughts towards the problems, correct plans and efficient coding with knowledge in the domain are the key to a successful code. However, this doesn’t mean that you should prolong you coding to a 1 week when you can produce a good clean code in 1 day. There needs to be a good balance.

  2. Practicing your coding skills.
    Online Judge systems are the best place to write your code in raw form restraining usage of your IDE to debug code. Usually, I would write down the problem. Then ask myself some questions related to the questions and start with a pseudocode. Then I would write the real code and constantly test throughout my writing of the code. This helped me with a couple of things, naturally. I can walk through the code easily as soon as I see some piece of the code. When I write my own code, I practice walking through the code a lot to test if it is working properly. By doing so, I think it is drawing out the picture of how the entire code works and at the same time, produces finer algorithm as I do more tests myself. I can tell my improvements in reading code has increased significantly after practicing through the online judge system. Secondly, you can build more confidence in your code. I have witnessed people who said the code must be acting “weird”. There is no “weird” code. It is either your logic is flawed or the assumptions are not correct. You should constantly ask yourself why it is behaving in a wrong way. Anyways, it is the programmer introducing the behavior and finding out the reason is also programmer’s responsibility. In my opinion, it is really black or white on the programming side of things. When you start writing in Online Judge system and run through their massive test data, you could be more alerted to the base conditions that you haven’t thought of to be checked which would eventually make the programmer guard these little things in the future.

LeetCode

Leetcode is by far the simplest and the most well organized for Java algorithms I have used so far. Leetcode offers a lot more than just algorithms they have consistent contests throughout the weekends and offer other areas of coding as well. Believe me, I have came used many other Online Judge sites in the past. HackerRank and Codility would probably be the next ones I would recommend. These two OJs have their merits compared to Leetcode such as categorization of algorithms. However, categorization isn’t really important for me when it comes to algorithms. What I like about LeetCode is they algorithms are divided into difficulty levels where I find quite useful because I do not want to spend an entire day to solve a problem. Normally I like Easy ones because they are very specific to the point of the algorithms and the way they use the data structures and applications aren’t much different throughout them. Medium is still okay compared to some of the Hard ones where I think choosing a right data structures and algorithms are critical to the problem. I literally spent almost half a day once trying to solve one of the hard ones. I honestly did not think at the time that the time was worth it for me. There is another huge part of LeetCode that I love. “Discussion” page. Problems come with a button called “Discussion”. When you go in their forum of discussion, there will be a variety of Java solutions (and other languages as well) done by other people. You can tell how others are thinking to solve the problem which sometimes is really unique and interesting. So if you ever try to solve a problem in LeetCode, solve it on your own and LeetCode will provide you with a distribution of your algorithm speed compared to other people, then I would suggest you go into Discussion, and see how others approached the certain problem.

Code Golf

I am not a fan of code golf. The idea of Code Golf is like Golf. In the game of Golf, your goal is to put the ball into the hole with the fewest swing as possible. Similarly, in Code Golf, you would want to write a code with shortest as possible. There was a time when someone asked me if I heard of Perl Golf. I said no. Apparently, code golf is often named with the language name in front, such as Perl Golf. Perl is probably the language where this Golf syndrome rose from. I have heard of Code Golf before but wasn’t familiar with Perl Golf. So you could add a language name in front such as Python Golf to represent the behavior of making the code short. Oh, by the way, when I say shortening the code, I don’t mean to do something like a minifier which simply has the purpose of just to make the code compact and small. “Shortening” I mean, making your logic simpler to have a shorter and neat code overall. Below are a few online judge sites that are for Code Golf.

Compilation of Online Judge Systems

List of Online Judge systems below. They can be really useful for practicing your code skills.

Share this post

Me

I am a passionate programmer working in Vancouver. I strongly believe in art of algorithms and together with it to write clean and efficient software to build awesome products. If you would like to connect with me, choose one from below options :) You can also send me an email at