Hello world! There is a choose function in math like "A choose B" notated sometimes like aCb I'm wondering if you can calculate this in O(1) in a program. Given two a and b, calculate a choose b.
You can definitely precompute many values, in an O(ab) loop keeping the factorials, but Can you do it without precomputation? However, precomputing also risks long long overflow. (usually choosing is much lower then the direct factorial value) Thank you
If we don't consider the modulo numbers, it can be solved in $$$O(b)$$$(Not considering the complexity of multiplication or division).
If we consider the modulo numbers, sometimes it can be faster but it requires precomputation.