fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int mod = 1e9 + 7;
  6. class Solution{
  7. public:
  8. int nCr(int n, int r){
  9. // code here
  10. if(r > n) {
  11. return 0;
  12. }
  13. if(r == n || r == 0) {
  14. return 1;
  15. }
  16.  
  17. return (nCr(n-1,r-1)%mod + nCr(n-1,r)%mod)%mod;
  18. }
  19. };
  20.  
  21.  
  22. int main() {
  23. // your code goes here
  24. return 0;
  25. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty