Cody

Solution 1945293

Submitted on 22 Sep 2019 by Bailey Horton
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
A = 1; B_correct = 1; assert(isequal(sandpile(A),B_correct))

2   Pass
A = [0 0 0;0 4 1;1 0 0]; B_correct = [0 1 0;1 0 2;1 1 0]; assert(isequal(sandpile(A),B_correct))

B = 0 0 0 0 0 1 1 0 0 B = 0 1 0 0 0 1 1 0 0 B = 0 1 0 0 0 1 1 1 0 B = 0 1 0 1 0 1 1 1 0 B = 0 1 0 1 0 2 1 1 0

3   Pass
A = [0 0 0 0;0 4 4 0;0 0 0 0]; B_correct = [0 1 1 0;1 1 1 1;0 1 1 0]; assert(isequal(sandpile(A),B_correct))

B = 0 0 0 0 0 0 4 0 0 0 0 0 B = 0 1 0 0 0 0 4 0 0 0 0 0 B = 0 1 0 0 0 0 4 0 0 1 0 0 B = 0 1 0 0 1 0 4 0 0 1 0 0 B = 0 1 0 0 1 0 5 0 0 1 0 0 B = 0 1 0 0 1 0 1 0 0 1 0 0 B = 0 1 1 0 1 0 1 0 0 1 0 0 B = 0 1 1 0 1 0 1 0 0 1 1 0 B = 0 1 1 0 1 1 1 0 0 1 1 0 B = 0 1 1 0 1 1 1 1 0 1 1 0

4   Pass
A = [0 0 0 0 0;0 0 0 0 0;0 0 17 0 0;0 0 0 7 0;0 0 0 0 0]; B_correct = [0 0 1 0 0;0 2 1 2 0;1 1 1 3 1;0 2 3 1 2;0 0 1 2 0]; assert(isequal(sandpile(A),B_correct))

B = 0 0 0 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 7 0 0 0 0 0 0 B = 0 0 0 0 0 0 0 1 0 0 0 0 13 0 0 0 0 0 7 0 0 0 0 0 0 B = 0 0 0 0 0 0 0 1 0 0 0 0 13 0 0 0 0 1 7 0 0 0 0 0 0 B = 0 0 0 0 0 0 0 1 0 0 0 1 13 0 0 0 0 1 7 0 0 0 0 0 0 B = 0 0 0 0 0 0 0 1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