Unit Testing Your Competitive Programming Solutions

A couple of months ago, I wrote an article about a type of unit test called a learning test. The goal of learning tests is improving your understanding of how code works, rather than verifying functionality or influencing design, the traditional goals of unit testing. This week, I’m going to discuss those traditional goals of […]

Continue

UVa 11572: Unique Snowflakes

UVa 11572 contains a story about a magic snowflake-capturing machine, but the underlying puzzle can be stated quite simply: Given a sequence of integers, find the length of the longest contiguous subsequence containing no repeated elements. The sequence given in the sample input is: 1, 2, 3, 2, 1 The subsequence 1, 2, 3, 2 […]

Continue

Summer Review

It’s summertime here in the Pacific Northwest, and seven months into the first year of this blog. After thirty weekly posts, I thought it would be a good time to consider the themes that have come up so far this year. If you’re a new reader, I hope you’ll find this to be a useful […]

Continue

Ignore This Advice

When you’re stuck on a programming problem for a while (everyone has their own time threshold), it’s customary to look for a hint. If you’re working on a competitive programming problem from a past contest, they’re easy to find. Problems on uHunt are categorized by algorithm, so that’s a big hint already. Popular problems often […]

Continue

Java Lessons from uHunt Chapter 1

This post is part of a series on Java syntax and libraries for solving the problems in each chapter of uHunt, a tool for competitive programming practice. You can find the rest of the posts in the series by visiting my uHunt Java post category. A few months ago, I wrote two posts related to […]

Continue

Profiling Java Programs with VisualVM

Last week, I wrote about ways to improve runtime performance for a Java solution to UVa 732. This week I’m going to cover a process for analyzing Java program performance using the profiling features of the VisualVM Java troubleshooting tool. But first, a note about profiling. As I mentioned last week, even a highly optimized […]

Continue

Implementing a Fast Solution to UVa 732

Programming puzzles are often designed in such a way that getting your solution to complete under the time limit is at least as challenging as getting the correct result. To create such a challenge, a problem setter can adjust the size of the input until sub-optimal solutions no longer run in under the time limit. […]

Continue

The Problem With Codecademy

I believe in the importance of practicing programming fundamentals, especially through programming puzzles. But puzzle learning works best when you already have some experience with the programming language you’re using to solve them. By prompting you to exercise a core set of programming fundamentals, puzzles help strengthen basic coding skills. To get those basic skills […]

Continue

Unit Testing the Java Class Library

Unit testing is a controversial topic in developer circles. Opinions range from Most Unit Testing is Waste to You are not allowed to write any production code unless it is to make a failing unit test pass. For those on the pro-unit testing side, there are numerous benefits to the practice, especially the test-first variety. […]

Continue