Cody

# Problem 112. Remove the air bubbles

Solution 1897014

Submitted on 11 Aug 2019 by Yuumi Ozaki
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 2 3 0 4 5 6 0 0 ]; b_correct = [ 0 0 0 1 2 3 6 4 5 ]; assert(isequal(bubbles(a),b_correct))

r = 3 c = 3 tem = 0 a = 1 2 3 1 4 5 6 0 0 a = 0 2 3 1 4 5 6 0 0 tem = 0 a = 0 2 3 1 4 5 6 4 0 a = 0 2 3 1 0 5 6 4 0 tem = 0 a = 0 2 3 1 2 5 6 4 0 a = 0 0 3 1 2 5 6 4 0 tem = 0 a = 0 0 3 1 2 5 6 4 5 a = 0 0 3 1 2 0 6 4 5 tem = 0 a = 0 0 3 1 2 3 6 4 5 a = 0 0 0 1 2 3 6 4 5 b = 0 0 0 1 2 3 6 4 5

2   Pass
a = [ 1 0 5 0 7 0 6 ]'; b_correct = [ 0 0 0 1 5 7 6 ]'; assert(isequal(bubbles(a),b_correct))

r = 7 c = 1 f = 1 5 7 6 d = 0 d = 0 0 d = 0 0 0 e = 0 0 0 1 5 7 6 b = 0 0 0 1 5 7 6

3   Pass
a = [1 0; 1 1]; b_correct = [1 0; 1 1]; assert(isequal(bubbles(a),b_correct))

r = 2 c = 2 b = 1 0 1 1

4   Pass
a = [0 8 0 6 -2]'; b_correct = [0 0 8 6 -2]'; assert(isequal(bubbles(a),b_correct))

r = 5 c = 1 f = 8 6 -2 d = 0 d = 0 0 e = 0 0 8 6 -2 b = 0 0 8 6 -2

### Community Treasure Hunt

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

Start Hunting!