Showing wrong ans

Consider the case when u have a single element in the array separately.