Updated Code

Updated code with solutions