Deciding mid in binary search
问题 I was practising a questions on hackerearth : https://www.hackerearth.com/practice/algorithms/searching/binary-search/practice-problems/algorithm/monk-and-special-integer-code-monk/ In this question I had written a binary search code where I had used: int mid=(low+high)/2 My loop got stuck here and so I was getting TLE for some cases. Having realised the problem (that repeatedly low was being chosen) I changed the mid to low +(high-low+1)/2 and with this change whole test cases passed. (Code