Just a little algorithm practice.