Link to the code : https://ide.codingblocks.com/s/232895
Pls help me to debug the code and let me know where I am wrong. Thanks!
Code is passing sample testcase but failing all the tescases on submission
Waoh! Thank you so much. I was struck on this qs from a long time. Starting from book[n-1] is a more optimal solution just wondering why itβs not working if I start from 0 ?
@18bcs036
If you take start as 0, for some testcase your mid might go below book[n-1] and checkconfig might return true in such case. Your ans will be wrong in such case.
Consider this testcase
1
4 4
1 2 3 5
output should be β5β but if you start with start=0, ans will be β1β
Please mark it as resolved if you got the logic.