test case 2 is getting wrong why?
Getting wrong answer
You are checking all the values assuming that all the values are positive in the array think of the case when all the values in the array are negative . The check variable is initialised as 0 . You should initialse check variable as INT_MIN . and then solve the problem it will work fine .
Hope it helps . Have a nice day 
If you have no further doubts mark the doubts as resolved
In question it is written that N is non negative…i thought its talking bout the numbers in array should be…
No it is the size of the array and not the elements in the array itself . is your doubt resolved now ?
Mark it as resolved if it is