Cody

# Problem 44439. Remove the air bubbles from a vector

Solution 2060366

Submitted on 17 Dec 2019 by anan jeraise
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
filetext = fileread('bubbles.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
v = [1 3 0 5 0 -1]'; w_correct = [0 0 1 3 5 -1]'; assert(isequal(bubbles(v),w_correct))

s = 6 i = 1 2 4 6 a = 4 z = 0 0 w = 0 0 1 3 5 -1

3   Pass
v = [0 0 9 2 6]'; w_correct = v; assert(isequal(bubbles(v),w_correct))

s = 5 i = 3 4 5 a = 3 z = 0 0 w = 0 0 9 2 6

4   Pass
v = [1 3 5 -1]'; w_correct = v; assert(isequal(bubbles(v),w_correct))

s = 4 i = 1 2 3 4 a = 4 z = 0×1 empty double column vector w = 1 3 5 -1

5   Pass
v = [0 1 0 1 1 1 0]'; w_correct = [0 0 0 1 1 1 1]'; assert(isequal(bubbles(v),w_correct))

s = 7 i = 2 4 5 6 a = 4 z = 0 0 0 w = 0 0 0 1 1 1 1

### Community Treasure Hunt

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

Start Hunting!