You are viewing a single comment's thread. Return to all comments →
C# one-line:
static int solve(long[] a)=>(int)((a.Aggregate(new BigInteger(1), (b, n) => (b * (BigInteger.ModPow(2, n, 1000000007)+1))%1000000007)-1)%1000000007);
Not very readable for java guys though...
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Shashank and List
You are viewing a single comment's thread. Return to all comments →
C# one-line:
static int solve(long[] a)=>(int)((a.Aggregate(new BigInteger(1), (b, n) => (b * (BigInteger.ModPow(2, n, 1000000007)+1))%1000000007)-1)%1000000007);
Not very readable for java guys though...