concise recursive solution
concise recursive solution