working through some algorithm problems for fun