Added map as another way to solve