We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
constintMOD=1000000007;// Function to perform modular exponentiationlonglongmodPow(longlongbase,longlongexp,intmod){longlongresult=1;base=base%mod;while(exp>0){if(exp&1){result=(result*base)%mod;}exp>>=1;base=(base*base)%mod;}returnresult;}// Function to calculate the sum of the seriesintsummingSeries(longn){longlongresult=modPow(n,2,MOD);returnresult;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Summing the N series
You are viewing a single comment's thread. Return to all comments →
in c++: