1 & 2 solved

optimization required