Cody

Problem 750. Accumulate Cells

Solution 2440655

Submitted on 31 May 2020 by Nikolaos Nikolaou
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
assert(isequal(accumcell(@plus,{1,2,3,4},0),10)) assert(isequal(accumcell(@times,{1,2,3,4},1),24)) assert(isequal(accumcell(@times,{1,2,3,4},0),0)) M = rand(3,4,5); C = num2cell(M,1:2); assert(isequal(accumcell(@plus,C,0),sum(M,3))) assert(isequal(accumcell(@times,C,1),prod(M,3)))

t = 3 t = 6 t = 10 t = 10 t = 2 t = 6 t = 24 t = 24 t = 2 t = 6 t = 24 t = 0 t = 0.8182 0.1838 0.8936 1.0216 0.5509 0.9211 1.5131 1.3273 1.2258 1.2668 0.4895 0.1815 t = 1.5121 0.3328 1.0240 1.2832 0.8658 1.9076 1.6414 2.2283 1.6276 1.7652 0.5015 1.1263 t = 1.5660 0.7712 1.0353 2.0193 1.1374 2.0013 2.4640 2.9014 2.0905 2.0823 0.6833 1.3295 t = 1.6456 1.5877 1.5861 2.9845 1.9834 2.5516 3.1683 3.7509 2.8932 2.2578 1.4233 1.4461 t = 1.6456 1.5877 1.5861 2.9845 1.9834 2.5516 3.1683 3.7509 2.8932 2.2578 1.4233 1.4461 t = 0.1353 0.0082 0.1857 0.0633 0.0278 0.0223 0.5556 0.3376 0.3440 0.3119 0.0580 0.0051 t = 0.0939 0.0012 0.0242 0.0165 0.0087 0.0220 0.0713 0.3042 0.1382 0.1555 0.0007 0.0048 t = 0.0051 0.0005 0.0003 0.0122 0.0024 0.0021 0.0586 0.2047 0.0640 0.0493 0.0001 0.0010 t = 0.0004 0.0004 0.0002 0.0118 0.0020 0.0011 0.0413 0.1739 0.0514 0.0086 0.0001 0.0001 t = 0.0004 0.0004 0.0002 0.0118 0.0020 0.0011 0.0413 0.1739 0.0514 0.0086 0.0001 0.0001

Suggested Problems

More from this Author11