Cody

# Problem 42676. Histogram of histogram

Solution 2186712

Submitted on 1 Apr 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   Pass
% Thanks to Alfonso Nieto-Castanon urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0&amp;d=1','SetSolutionScore.p'); rehash path;

2   Pass
fh = fopen('EvaluateSolution.p','wb'); fwrite(fh, hex2dec(reshape('7630312E30307630302E3030000E501C677E5FB10000006D000000D20000011913C0FE1CB1DCFB0EAA5AF856073976051831C95E8D334FE36CD669CF5BF744E1161AA6E2626D6FCADA7C4C614946CCB161197CAC7669759DCC74F111D48BE15A97429389C1D5EF5C61BA6AF9C735F6B819F7A12D0870F8A583D6E17EC695B1F38F3B6F245C9126934D9A3BAEBE1B3EB491EC86B99D31CE1265BC7AEB41CDBB4EE66443A9D8D68B5520B1A41DC2AF3D5E10D0E5520B2FEC6B27A923229B0F53B8782D8C186F881812658B74C34C83D93669851285BF570F637CB64D19CB5F1DC2E8AF8CB2324F1D8C467E170E921D55B45BC9',2,[]).')); rehash path; fclose(fh);

3   Pass
x = ones(3); y_correct(3,3) = 0; y_correct(3,:) = 1; assert(isequal(HoH(x),y_correct))

4   Pass
x = repmat((1:10).',1,3); y_correct = 10*ones(1,3); assert(isequal(HoH(x),y_correct))

5   Pass
x = [1 2 2 3 2 3 3 6 1 3 1 1 6 3 2 5 2 2 4 2]; y_correct = [1 0 3 5 2 1 1 0 0 1 0 0]; assert(isequal(HoH(x),y_correct))

6   Fail
S = 1e7; m = 50; n = ceil(S/log(S)); t = zeros(3,1); for k = 1:numel(t) x = randi(S,n,m,'uint32'); t0 = builtin('tic'); y = HoH(x); t(k) = builtin('toc',t0); assert(EvaluateSolution(x,y)); end SetSolutionScore(round(mean(t)*10));

Requested 9549738x620421 (5518.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. Error in HoH (line 6) h(:,end+1) = sum(z' == e,2); Error in Test6 (line 7) y = HoH(x);

### Community Treasure Hunt

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

Start Hunting!