Cody

# Problem 229. Fizz Buzz

Solution 898257

Submitted on 29 May 2016 by William
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 = 1; y_correct = {'1'}; assert(isequal(fizzbuzz(x),y_correct))

2   Pass
x = 3; y_correct = {'fizz'}; assert(isequal(fizzbuzz(x),y_correct))

y = 'fizz'

3   Pass
x = 5; y_correct = {'buzz'}; assert(isequal(fizzbuzz(x),y_correct))

4   Pass
x = 15; y_correct = {'fizzbuzz'}; assert(isequal(fizzbuzz(x),y_correct))

5   Pass
x = [1 3 5 15 16]; y_correct = {'1', 'fizz', 'buzz', 'fizzbuzz','16'}; assert(isequal(fizzbuzz(x),y_correct))

y = '1' 'fizz' [] [] []

6   Pass
x = []; y_correct = {}; assert(isequal(fizzbuzz(x),y_correct))

7   Pass
x = 1:100; y_correct = {'1', '2', 'fizz', '4', 'buzz', 'fizz', '7', '8', 'fizz', 'buzz', '11', 'fizz', '13', '14', 'fizzbuzz', '16', '17', 'fizz', '19', 'buzz', 'fizz', '22', '23', 'fizz', 'buzz', '26', 'fizz', '28', '29', 'fizzbuzz', '31', '32', 'fizz', '34', 'buzz', 'fizz', '37', '38', 'fizz', 'buzz', '41', 'fizz', '43', '44', 'fizzbuzz', '46', '47', 'fizz', '49', 'buzz', 'fizz', '52', '53', 'fizz', 'buzz', '56', 'fizz', '58', '59', 'fizzbuzz', '61', '62', 'fizz', '64', 'buzz', 'fizz', '67', '68', 'fizz', 'buzz', '71', 'fizz', '73', '74', 'fizzbuzz', '76', '77', 'fizz', '79', 'buzz', 'fizz', '82', '83', 'fizz', 'buzz', '86', 'fizz', '88', '89', 'fizzbuzz', '91', '92', 'fizz', '94', 'buzz', 'fizz', '97', '98', 'fizz', 'buzz'}; assert(isequal(fizzbuzz(x),y_correct))

y = Columns 1 through 15 '1' '2' 'fizz' [] [] [] [] [] [] [] [] [] [] [] [] Columns 16 through 31 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 32 through 47 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 48 through 63 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 64 through 79 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 80 through 95 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 96 through 100 [] [] [] [] [] y = Columns 1 through 14 '1' '2' 'fizz' '4' 'buzz' 'fizz' [] [] [] [] [] [] [] [] Columns 15 through 30 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 31 through 46 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 47 through 62 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 63 through 78 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 79 through 94 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 95 through 100 [] [] [] [] [] [] y = Columns 1 through 13 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' [] [] [] [] Columns 14 through 29 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 30 through 45 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 46 through 61 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 62 through 77 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 78 through 93 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 94 through 100 [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 26 'fizz' [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 27 through 42 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 43 through 58 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 59 through 74 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 75 through 90 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 91 through 100 [] [] [] [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 23 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' [] [] [] [] [] Columns 24 through 39 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 40 through 55 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 56 through 71 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 72 through 87 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 88 through 100 [] [] [] [] [] [] [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 37 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 38 through 53 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 54 through 69 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 70 through 85 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 86 through 100 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 36 '22' '23' 'fizz' [] [] [] [] [] [] [] [] [] [] [] [] Columns 37 through 52 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 53 through 68 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 69 through 84 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 85 through 100 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 34 '22' '23' 'fizz' 'buzz' '26' 'fizz' [] [] [] [] [] [] [] Columns 35 through 50 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 51 through 66 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 67 through 82 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 83 through 98 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 99 through 100 [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 31 '22' '23' 'fizz' 'buzz' '26' 'fizz' '28' '29' 'fizzbuzz' '31' Columns 32 through 46 '32' 'fizz' [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 47 through 62 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 63 through 78 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 79 through 94 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 95 through 100 [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 31 '22' '23' 'fizz' 'buzz' '26' 'fizz' '28' '29' 'fizzbuzz' '31' Columns 32 through 44 '32' 'fizz' '34' 'buzz' 'fizz' [] [] [] [] [] [] [] [] Columns 45 through 60 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 61 through 76 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 77 through 92 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 93 through 100 [] [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 31 '22' '23' 'fizz' 'buzz' '26' 'fizz' '28' '29' 'fizzbuzz' '31' Columns 32 through 43 '32' 'fizz' '34' 'buzz' 'fizz' '37' '38' 'fizz' [] [] [] [] Columns 44 through 59 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 60 through 75 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 76 through 91 [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Columns 92 through 100 [] [] [] [] [] [] [] [] [] y = Columns 1 through 11 '1' '2' 'fizz' '4' 'buzz' 'fizz' '7' '8' 'fizz' 'buzz' '11' Columns 12 through 21 'fizz' '13' '14' 'fizzbuzz' '16' '17' 'fizz' '19' 'buzz' 'fizz' Columns 22 through 31 '22' '23' 'fizz' 'buzz' '26' 'fizz' '28' '29' 'fizzbuzz' '31' Columns 32 through 41 '32' 'fizz' '34' 'buzz' 'fizz' '37' '38' 'fizz' 'buzz' '4...