Topcoder and Leetcode Problems for Review and Practice

James S. Plank, University of Tennessee

The purpose of this web site is to have a bunch of Topcoder (and Leetcode) problems for CS140 and CS302 students to go through on their own for practice. In these files, I will give various hints and perhaps solutions to the problems.

Please email me if you see typos and/or problems with any of these writeups.


Finding the problems on Topcoder

You'll need to create an account at topcoder.com. Then, go to https://arena.topcoder.com and click on the icon on the top of the page that says "practice problems" (you have to point the mouse to the icon to see the text). That will take you to a page with a search bar, and you search for the problem name. The links in the in the writeups have gotten to the point where they work only sporadically, so before you give up, go to this link and search for the problem.

Leetcode

Leetcode is another one of these programming web sites, like Topcoder, that has been a popular tool for job interviewers. I'll sprinkle in some Leetcode problems below as well.

Doing these without Topcoder/Leetcode's Servers

As time has gone on, I'm afraid that Topcoder's servers have become unreliable. I haven't had that problem with Leetcode yet, but you never know. For that reason, I am going through these writeups, and making sure that you can do the problems without having to rely on Topcoder/Leetcode's servers working.

The problem "Cryptography" (SRM 480, D2, 250-Pointer) has a writeup on how to do the problem without Topcoder's servers, and how to test yourself. Please do that problem first, when you're starting to practice with these problems. That will help you form a workflow that works effectively when Topcoder/Leetcode's servers are down.

When I finish writing up a problem and providing testing information so that you can do it without the servers, I will color the problem's listing below in red.


D2 250-point Practice Problems

When students ask me what they can do to prepare for CS302 (and even CS140), my response is always, "Topcoder." The 250-point problems from Division 2 are great in this regard, because they typically require small (10-line) solutions, and are straightfoward. Your goal with these problems should be to get them within 20 minutes or so. When you get better at coding quickly, make that goal 5 minutes!

With these web pages, what you should do is the following:

I'm going to order these problems from easiest to hardest, using the success rates from Topcoder as the metric. The S/N designations are whether or not I provide a solution.


D1 250-point Problems (or D2 500-point Problems or Leetcode Mediums)

These are harder than the problems above, and often fit into some class of algorithm from CS202 or CS302. The percentages for the D2, 500-pointers are much lower than the D1, 250 pointers for two reasons: First, the programmers in D1 are better. Second, by the time the D2 programmers get to the 500-point problem, they may not have time to complete it. Keep that in mind.

D1 500-point Problems (or D2 1000-point Problems or Leetcode Hard Problems)

For these, I rank them by (number correct / number opened), but I also report (number correct / number submitted). It's hard to gauge these, again, because it's hard to know how much time a competitor had when he/she opened the problem. There is also the issue that with some of these programs, programming up the solution is really easy once you've figured out the solution, so the second numbers will be pretty high, even though the problem is hard.

With Leetcode, I simply put question marks in the (number correct / number opened), because Leetcode only reports (number correct / number submitted).