CodeNewbie Community 🌱

Discussion on: Coding Challenge

Collapse
 
djuber profile image
Daniel Uber

I used to use Project Euler, which is probably more fun if you also are mathematically inclined. The variety of problems were helpful, and there are typically both a brute force and a more elegant solution to the problems. It might be easier with Java than C for problems requiring really large numbers (some of them are well handled by unsigned long, other problems would be better served by BigNumber types since the answers would otherwise overflow). If you used a language that had automatic arbitrary precision integers (python, ruby, lisp, probably a number of others) you could avoid some of the "big number" headaches.

If you're not specifically interested in math, Advent of Code has a all their challenges from 2015 to present available - it's similar to project euler (given a problem description and some input, you run the code and supply an answer to the form, rather than submitting code to an automatic judge that runs your solution against hidden input and gives a pass/fail response). It's possibly more fun if you're doing this with your peers in December, but the problems might take more than a day of your free time so there's no harm in practicing during the summer.

spoj.com/ is an example of an online judge site (and there a few recent books about competitive programming that highlight techniques for solving these problems). I find these are harder to understand (you get really limited feedback, like "didn't complete in the allotted time", "failed to compile", "completed but gave wrong output" and you have to be really careful in building the solution according to the specification (read input, process information, output exact response format down to the number of spaces or blank lines between output groups). And you have to do this in a performant way for the range of inputs provided. Because the judge runs the code on hidden input and only tells you whether you completed with the right answer, it's much harder to understand what went wrong with your program and why.

I think all of these fall under the "challenge site" category listed on the wikipedia page en.wikipedia.org/wiki/Competitive_...

If you remove the time pressure of competition, they're still valuable puzzles to explore and solve while you grow your skills, and will probably force you to rewrite a "barely working" solution to a more performant one, as you understand the problem better.