Updated solution

updated solution