Don’t know where the mistake is
One test case is coming wrong
min variable should not start from 0
it should start from the largest value of the array
in the for loop
initialise it as
for(int x: arr)
min = Math.max( min , x) ;
Don’t know where the mistake is
min variable should not start from 0
it should start from the largest value of the array
in the for loop
initialise it as
for(int x: arr)
min = Math.max( min , x) ;