Cody

Problem 43222. Persistence will help you solve almost any problem.

Solution 2173727

Submitted on 25 Mar 2020 by Asif Newaz
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
for i = 1:100 a = counterfun; validatestring(char(a), {char(i)}) assert(isequal(a,i)) end

n = 1 a = 1 ans = '' n = 2 a = 2 ans = '' n = 3 a = 3 ans = '' n = 4 a = 4 ans = '' n = 5 a = 5 ans = '' n = 6 a = 6 ans = '' n = 7 a = 7 ans = '' n = 8 a = 8 ans = '' n = 9 a = 9 ans = ' ' n = 10 a = 10 ans = ' ' n = 11 a = 11 ans = ' ' n = 12 a = 12 ans = ' ' n = 13 a = 13 ans = ' ' n = 14 a = 14 ans = '' n = 15 a = 15 ans = '' n = 16 a = 16 ans = '' n = 17 a = 17 ans = '' n = 18 a = 18 ans = '' n = 19 a = 19 ans = '' n = 20 a = 20 ans = '' n = 21 a = 21 ans = '' n = 22 a = 22 ans = '' n = 23 a = 23 ans = '' n = 24 a = 24 ans = '' n = 25 a = 25 ans = '' n = 26 a = 26 ans = '' n = 27 a = 27 ans = '' n = 28 a = 28 ans = '' n = 29 a = 29 ans = '' n = 30 a = 30 ans = '' n = 31 a = 31 ans = '' n = 32 a = 32 ans = ' ' n = 33 a = 33 ans = '!' n = 34 a = 34 ans = '"' n = 35 a = 35 ans = '#' n = 36 a = 36 ans = '$' n = 37 a = 37 ans = '%' n = 38 a = 38 ans = '&' n = 39 a = 39 ans = ''' n = 40 a = 40 ans = '(' n = 41 a = 41 ans = ')' n = 42 a = 42 ans = '*' n = 43 a = 43 ans = '+' n = 44 a = 44 ans = ',' n = 45 a = 45 ans = '-' n = 46 a = 46 ans = '.' n = 47 a = 47 ans = '/' n = 48 a = 48 ans = '0' n = 49 a = 49 ans = '1' n = 50 a = 50 ans = '2' n = 51 a = 51 ans = '3' n = 52 a = 52 ans = '4' n = 53 a = 53 ans = '5' n = 54 a = 54 ans = '6' n = 55 a = 55 ans = '7' n = 56 a = 56 ans = '8' n = 57 a = 57 ans = '9' n = 58 a = 58 ans = ':' n = 59 a = 59 ans = ';' n = 60 a = 60 ans = '<' n = 61 a = 61 ans = '=' n = 62 a = 62 ans = '>' n = 63 a = 63 ans = '?' n = 64 a = 64 ans = '@' n = 65 a = 65 ans = 'A' n = 66 a = 66 ans = 'B' n = 67 a = 67 ans = 'C' n = 68 a = 68 ans = 'D' n = 69 a = 69 ans = 'E' n = 70 a = 70 ans = 'F' n = 71 a = 71 ans = 'G' n = 72 a = 72 ans = 'H' n = 73 a = 73 ans = 'I' n = 74 a = 74 ans = 'J' n = 75 a = 75 ans = 'K' n = 76 a = 76 ans = 'L' n = 77 a = 77 ans = 'M' n = 78 a = 78 ans = 'N' n = 79 a = 79 ans = 'O' n = 80 a = 80 ans = 'P' n = 81 a = 81 ans = 'Q' n = 82 a = 82 ans = 'R' n = 83 a = 83 ans = 'S' n = 84 a = 84 ans = 'T' n = 85 a = 85 ans = 'U' n = 86 a = 86 ans = 'V' n = 87 a = 87 ans = 'W' n = 88 a = 88 ans = 'X' n = 89 a = 89 ans = 'Y' n = 90 a = 90 ans = 'Z' n = 91 a = 91 ans = '[' n = 92 a = 92 ans = '\' n = 93 a = 93 ans = ']' n = 94 a = 94 ans = '^' n = 95 a = 95 ans = '_' n = 96 a = 96 ans = '`' n = 97 a = 97 ans = 'a' n = 98 a = 98 ans = 'b' n = 99 a = 99 ans = 'c' n = 100 a = 100 ans = 'd'