added an implementation of simple recursive solution