solved with basics and recurse method