Cody

# Problem 112. Remove the air bubbles

Solution 2002126

Submitted on 4 Nov 2019 by Doan Quang Manh
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))

c = 1 0 6 c1 = 0 c2 = 1 6 c3 = 0 1 6 b = 0 1 6 c = 2 4 0 c1 = 0 c2 = 2 4 c3 = 0 2 4 b = 0 1 6 0 2 4 c = 3 5 0 c1 = 0 c2 = 3 5 c3 = 0 3 5 b = 0 1 6 0 2 4 0 3 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))

c = 1 0 5 0 7 0 6 c1 = 0 0 0 c2 = 1 5 7 6 c3 = 0 0 0 1 5 7 6 b = 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))

c = 1 1 c1 = 0×1 empty double column vector c2 = 1 1 c3 = 1 1 b = 1 1 c = 0 1 c1 = 0 c2 = 1 c3 = 0 1 b = 1 1 0 1 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))

c = 0 8 0 6 -2 c1 = 0 0 c2 = 8 6 -2 c3 = 0 0 8 6 -2 b = 0 0 8 6 -2 b = 0 0 8 6 -2