# Calculating nCr mod (10^9 + 7) for large n

Hi all, I want to know approach on how does one calculate nCr mod (10^9 + 7) for large n efficiently. Max constraint on n is 10^9 and r is 10^3. Please share your approach!!

1 Like

Hmmmmm

1 Like

i donâ€™t think its wrong to answer to such question and also ask as it is quite common and basic thingâ€¦

Its a controversial topic. There are many people against it with valid arguments, and many people support it and their arguments are valid as well.

Sorryâ€¦i didnt know it was from some ongoing contest,and since it was just a basic question ,i decided to answerâ€¦

@vivek_1998299 Donâ€™t worry about it. You acted in good faith, you couldnâ€™t have known this was related to an ongoing contest. The disappointment is with the user who asked the question, not you.

Hi all. I didnâ€™t have any bad intention. Say, suppose in tommorrowâ€™s contest there will be a problem relating to djisktraâ€™s. Does that mean that during whole contest itâ€™s prohibited to discuss anything related to djisktraâ€™s algorithm ? Tell me ?

Ofcourse, thereâ€™s no fault of @vivek_1998299. Morever, I took implementation from site (i will post here after contest ends) and gave proper attributes and references !!

In brief, my point is if for example someone needs help with Dijkstra but thereâ€™s some long challenge having a problem about Dijkstraâ€™s algorithm, do you think nobody should say a word about Dijkstra during the long contest? Moreover, where is nCr even written in problem statement of BBRICKS ? @gorre_morre, @algmyr, @vijju123

Oh come on. The constraints are the exact constraints for BBRICKS, and it was obvious from context the question was asked in relation to that specific task. There is a huge difference between asking some generic question and asking a question thatâ€™s obviously related to an active competition. If you had actually framed it as some generic question I wouldnâ€™t have minded that much, but as it stands itâ€™s just asking for help for a specific ongoing contest problem. @vivek_shah98

1 Like

@algmyr, you can check my implementation for this problem after the contest! I have added reference link from where I got the implementation. So even, if anyone wouldnâ€™t have answered my query, I could have solved the problem, no matter what, from the reference link, which I have mentioned in my submission. â€śit was obvious from context the question was asked in relation to that specific taskâ€ť, how does constraint which I mentioned guarantee that question was related to that particular task. There are many task with having same constraints.

As I said, its a controversial topic. Yes, we cannot in general prohibit any discussion - whether contest or not, but its expected that contestants maintain decorum and guide themselves in accordance to moral rules and spirit of competition. As such, asking a question, which is very very related to the live contestâ€™s problemset, is always looked down upon, whether explicitly stated in rules or not. At cases, the users say that â€śThis problem is from live contest, we will answer it after contest ends.â€ť. There are varying approaches and sides to this issue.

1 Like

@vivek_shah98 Youâ€™re free and even encouraged to search for information wherever you want. Read Wikipedia, read previously asked question stackexchange-like sites, read published articles, use oeis, whatever you wish! What I find in bad taste is asking this kind of question directly connected to a contest during a contest.

1 Like