Confusion on line 19

what is the significance of ll denom = 1 ll on the place of only 1

Hey @prashantgupta9876

If its only
ll denom=1ll;
Then it will work same as
ll denom =1;

Otherwise 1ll is used to avoid overflow on RHS
Say u have two integers whose product is long long
Then if u multiply them they will overflow
So to avoid this overflow we multiply them with 1ll which makes RHS as long long so overflow doesn’t occur

int a=INT_MAX;
Int b=INT_MAX;
ll prod=a*b;//overflow
ll prod1=1ll*a*b; //work fine

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.

Okay, thanks borther got it…just a small thing but have a big meaning

1 Like