Wrong ans for 1 test case , please check :(

line 18 int st=arr[num_of_books-1];
is wrong u have to take st as max element of input aray
and it need not be the last elemetn always and u cannot sort it for
while calculating the end
st = Math.max( st , arr[i])
has to be ur approach

mam i have done this , but still wrong ans for 1 test case

if(num_of_books<num_of_students){
System.out.print(“0”);
return;
}

remove this condition

but mam why??? becoz it can be a case

yes and possible o/p is displayed in that case too

mam i have more doubts in other questions , aap vo bhi dekh lo please

Thanks for this ques :slight_smile:

1 Like

yr seperate thread bana lia karo
its diff to attend on same doubt.