Cody

Solution 1483239

Submitted on 8 Apr 2018 by bainhome
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 = 3.5259e+11 ans = 1.0714e+12 ans = 1.4681e+11 ans = 6.6127e+09 ans = 9.7939e+11 ans = 4.2083e+11 ans = 1.1716e+12 ans = 5.4364e+11 ans = 2.4336e+11 ans = 5.9305e+10 ans = 5.4423e+11 ans = 1.1862e+12 ans = 7.8266e+11 ans = 3.0255e+11 ans = 1.1694e+12 ans = 9.2690e+10 ans = 8.1775e+11 ans = 4.0596e+11 ans = 9.3303e+10 ans = 2.5977e+11 ans = 4.0319e+11 ans = 5.3988e+11 ans = 2.3466e+11 ans = 4.9932e+11 ans = 3.1109e+11 ans = 7.7229e+09 ans = 1.7987e+10 ans = 9.9017e+10 ans = 5.8216e+11 ans = 2.3623e+11