C++ | Calculate nCr
Code

# Code
```cpp []
class Solution {
public:
    #define ll long long
    int mod=1000000007,K=70;
    ll nCr[100001][71];
    int minMaxSums(vector<int>& nums, int k) 
    {
        int size=nums.size();
        for(int n=0;n<size;n++)
        {
            nCr[n][0]=1;
            for(int r=1;r<=min(n,K);r++)
            {
                nCr[n][r]=(nCr[n-1][r]+nCr[n-1][r-1])%mod;
            }
        }
        sort(nums.begin(),nums.end());
        ll res=0;
        for(int i=0;i<size;i++)
        {
            int m=min(k-1,i);
            ll maxSum=0,minSum=0;
            for(int r=0;r<=m;r++)
                maxSum=(maxSum+nCr[i][r])%mod;
            m=min(k-1,size-1-i); 
            for(int r=0;r<=m;r++)
                minSum=(minSum+nCr[size-1-i][r])%mod;
            ll total=(minSum+maxSum)%mod;      
            ll curr=(total*nums[i])%mod;   
            res=(res+curr)%mod;   
        }
        return res;
    }
};
```
['C++']