Issue with java solution


#1

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