adding problem
adding solution and better optimization