Cody

Solution 2111712

Submitted on 30 Jan 2020 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
for k=1:30 N = randi(1701034); tic; S = sum(1:N); elapsedSum = toc; tic; Y = performance(N); elapsedPerf = toc; assert(isequal(S,Y),'Not equal sums'); assert(elapsedPerf < elapsedSum,'Not performing better than sum(1:N)'); end

ans = 1.0225e+12 ans = 1.0129e+12 ans = 6.2146e+11 ans = 7.1822e+10 ans = 1.0269e+12 ans = 4.2878e+09 ans = 9.4728e+11 ans = 9.0344e+11 ans = 1.1541e+11 ans = 1.1349e+12 ans = 4.3906e+10 ans = 8.5663e+11 ans = 6.2626e+10 ans = 4.0218e+09 ans = 8.8387e+11 ans = 1.1474e+11 ans = 3.3461e+11 ans = 1.3582e+10 ans = 2.0069e+11 ans = 1.9091e+11 ans = 1.8373e+11 ans = 1.7986e+11 ans = 1.2878e+11 ans = 1.2747e+11 ans = 7.7242e+09 ans = 5.6567e+11 ans = 1.3949e+12 ans = 9.1925e+11 ans = 8.9453e+11 ans = 2.4404e+09