Cody

# Problem 42834. Integer complexity (Large numbers)

Solution 2959222

Submitted on 17 Sep 2020
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   Fail
n = 1:11; c_correct = [1,2,3,4,5,5,6,6,6,7,8]; assert(isequal(intcomp2(n),c_correct))

Index in position 1 exceeds array bounds (must not exceed 2). Error in intcomp2 (line 5) c = work(n,2); Error in Test1 (line 3) assert(isequal(intcomp2(n),c_correct))

2   Fail
n = [60 27 72 1 51 24 46 58 65 47 78 62]; c_correct = [12 9 12 1 12 9 12 13 13 13 13 13]; assert(isequal(intcomp2(n),c_correct))

Index in position 1 exceeds array bounds (must not exceed 2). Error in intcomp2 (line 5) c = work(n,2); Error in Test2 (line 3) assert(isequal(intcomp2(n),c_correct))

3   Fail
global sol_score n = (1:10)*1e4; c_correct = [28,30,31,32,33,33,32,34,34,35]; tic, c = intcomp2(n); sol_score = toc assert(isequal(c,c_correct))

Index in position 1 exceeds array bounds (must not exceed 2). Error in intcomp2 (line 5) c = work(n,2); Error in Test3 (line 4) tic, c = intcomp2(n); sol_score = toc

4   Pass
% Scoring function by LY Cao global sol_score fid = fopen('score.p','wb'); fwrite(fid,sscanf('7630312E30307630302E30300008501CD77E9FB100000035000001110000018422762999A8C1DE50537BEE443F4D73651F830FC6C78ADFB7DF68DF98823F565884DC58E21C7E397E3D26E4FFEA9A0D83589ABB5C0B0B553B44CFD79C9B272D11DF1965AD538598E8319529727DF4C4CF36A6016DD7816544AE5A8F64C9B2D9D0C4B94DD5EDF14595CBFE3D402647499EA3D9D125AC927454ED85973BCD1AAEA536D5A6CDDCD78A0211E8179603FFE12E4AB0E4704EA195704428700BAE5C4DFD42FF1A8760EDF2721F9724498ECC9F957735E7A3CDB9630DB17DF92ACE8F486706020E0A8D022D14BC313879724760AE20D67F572DD85211E4BEA45CDF3E22976253F113AEA96C1FF907329E4BD429BCFC6331077DA21F05D791DA6ECCF680D2E23AC77DFCE5C1D9869D3098F5B89FF92A','%2x')); fclose(fid); score(sol_score);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!