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:
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 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.
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.
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.
List of Online Judge systems below. They can be really useful for practicing your code skills.