Why it's giving me a wrong answer although my approach is correct please help and correct it out!