Cody

# Problem 45421. Abelian Sandpile - 02

Solution 2190829

Submitted on 3 Apr 2020 by Binbin Qi
• Size: 19
• This is the leading solution.
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))

### Community Treasure Hunt

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

Start Hunting!