✅ Gaps in understanding a LC solution
It's about comprehending this solution https://leetcode.com/problems/binary-search/solutions/3365281/binary-search-c/
Question 1: why is the condition for the while loop like this?
Question 2: why is this line of code located in the while loop, not outside of it?
Question 3: why does
Question 1: why is the condition for the while loop like this?
left <= right, not left < rightQuestion 2: why is this line of code located in the while loop, not outside of it?
int middle = left + (right-left)/2;Question 3: why does
int middle = left + (right-left)/2; compile and why int middle = (left + (right-left))/2; not?LeetCode
View MaddiSwetha's solution of Binary Search on LeetCode, the world's largest programming community.
