Some algorithm practice here.