Plz correct this
The only issue your code is having when it has to deal with only single element present in the array. Have just added an if condition in it, now it will pass test cases
If you want to know what test case were you missing it is:
1
-1
Expected answer: -1
Yours is giving: 1
Rest everything is fine
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.