Doubt in the logic

Sir/maam, my answer got accepted but can you tell whether to take 32 or 64 in the last loop. And how do we come to know where to take what if we don’t know the compiler type.

hello @vageesha

its depend on the output range. if ur output can exceed the range of int (2^32 roughly) then iterate uptill 64 otherwise 32 works fine.

and to determine the output range, look at input constraints if we need long long datatype to store them,then in that case iterate till 64

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.