Naive algorithm practice