Can anyone tell me the idea of how to apply Binary Search in the Winning CB scholarship question??
Winning CB scholarship doubt
Its a good question of Binary Search .
You know the lower limits and the upper limits of answer are 0 and N respectively , so use these limits for binary search . and in every iteration check wheather mid ( mid=(si+ei)/2) is a possible answer ,if yes then save mid in some variable and move to right part ( i.e. si=mid+1)
else move to left part ( ei=mid-1)
You just need to buiild a boolean function which checks wheather a number can be a possible answer or not
Hint :-> condition
(possible answer )*x <=m+ (n-possible answer)*y