Cody

Problem 45421. Abelian Sandpile - 02

Solution 2938861

Submitted on 11 Sep 2020 by Alfonso Nieto-Castanon
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
x = [4 3 2 1 0 1 2 3 4 3 3 2 1 0 1 2 3 3 2 2 2 1 0 1 2 2 2 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 2 2 2 1 0 1 2 2 2 3 3 2 1 0 1 2 3 3 4 3 2 1 0 1 2 3 4]; assert(isequal(abelian_sandpile_2(4),x))

2   Pass
x = [2 1 0 1 2 1 1 0 1 1 0 0 0 0 0 1 1 0 1 1 2 1 0 1 2]; assert(isequal(abelian_sandpile_2(2),x))

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

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!