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!!

Hmmmmm Hmmmm

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