recursive solution added to extras