In binary we have low and high values upon which we move either left or right. I'm solving questions on binary search and have a confusion on which value to return; low or high. For eg., to find the square root of a number using binary search when I returned low, the output was incorrect but when I returned high it passed all the cases. Similarly for this question, I returned the low and got the correct output. Is there any specific trick to decide what exactly to return?
Thanks in advance.
I couldn't really come up with a solution to this. Whenever I get wrong output, I switch the output between low and high and it works.