My approach is exactly same as the one written in solution approach. Why am I getting timeout exceeded issue?