Please explain the approach for this problem

hello @nidhigupta847
approach they already explained .
if any step is clear then pls let me know i will try to explain

if (big - subtract <= add - small)

small = subtract;

else

big = add;

This part

this part is just for updating the slab.
we have two way of updation either we update our small or big.
now which one to update ? it is based on the new difference we will get. we will update to that slab which will give less difference.
and this is what they are doing . they are comparing the two possible slab and choosing that slab which is giving less difference
if big - subtract <= add -small then that means the new range
[ subtract…big] is producing less result compared to [small…add] hence we need to update or small value to subtract.

if this condition not satisfies then we need to update our big to add

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.