Cody

# Problem 44439. Remove the air bubbles from a vector

Solution 2058177

Submitted on 15 Dec 2019 by lior dmitrichenko
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))

t = 6 n = 3 5 v = 1 3 5 -1 b = 2 vec = 0 0 v1 = 0 0 0 0 0 0 v1 = 0 0 1 3 5 -1 w = 0 0 1 3 5 -1

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

t = 5 n = 1 2 v = 9 2 6 b = 2 vec = 0 0 v1 = 0 0 0 0 0 v1 = 0 0 9 2 6 w = 0 0 9 2 6

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

t = 4 n = 0×1 empty double column vector v = 1 3 5 -1 b = 0 vec = 0×1 empty double column vector v1 = 0 0 0 0 v1 = 1 3 5 -1 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))

t = 7 n = 1 3 7 v = 1 1 1 1 b = 3 vec = 0 0 0 v1 = 0 0 0 0 0 0 0 v1 = 0 0 0 1 1 1 1 w = 0 0 0 1 1 1 1