Please Help me in the book allocation problems, Output is showing correct but test cases are not passing correctly

https://online.codingblocks.com/app/player/161395/content/158307/5276

Hey @yashratnani6 are you getting TLE or Wrong answer in your left over test cases?

Wrong Test cases but custom output is correct

Let me find if there’s any error

Initialise sum =1 in line 6
P =0 in 7
In line number 23 you are declaring s = arr[n-1] thinking array will be in sorted ascending order. Instead find the maximum element in for loop only.
Take reference from this code


And apply it in your logic and it will get accepted :slight_smile:

hello @yashratnani6 isnt your doubt resolved yet ?

I found out that there was only a bracket misplacement in if else block

so what is the problem that you are facing now ?
is your code passing test cases now or not ?