Code not working Please help
hello @abhinavgoyal912
add if statement inside this loop

if(check > val){
e=mid-1;
break;
}
in out of the for loop
check if break statement of for loop is execute or not.
if it is then continue again from start.
this is done to avoid overflow.
stilll not woring i tried doing this after seeing the editorial and in place of continue i think break should come
yeah break should be there .
also because we have already performed updation inside loop .
we should not update it again so use continue in while loop if this condition is achieved
you mean i shouldnt put else statement in while loop?
i did that too but still didnt work
check this i have updated ur code ->
note ->
i have shrinked the search space to avoid overflow.
value of val can be upto 10^15
and val^2 will clearly exceed long long range
so to avoid such scenario i did that
okay sir got it !Thanks
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.