Cody

# Problem 63. Encode Roman Numerals

Solution 1924810

Submitted on 7 Sep 2019 by Nikolaos Nikolaou
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 = 1990; y_correct = 'MCMXC'; assert(isequal(dec2rom(x),y_correct))

t = 0 9 9 1 l1 = 'M' l2 = 0×0 empty char array l3 = 'XC' l4 = 'CM' romStr = 'MCMXC'

2   Pass
x = 2008; y_correct = 'MMVIII'; assert(isequal(dec2rom(x),y_correct))

t = 8 0 0 2 l1 = 'MM' l2 = 'VIII' l3 = 0×0 empty char array l4 = 0×0 empty char array romStr = 'MMVIII'

3   Pass
x = 1666; y_correct = 'MDCLXVI'; assert(isequal(dec2rom(x),y_correct))

t = 6 6 6 1 l1 = 'M' l2 = 'VI' l3 = 'LX' l4 = 'DC' romStr = 'MDCLXVI'

4   Pass
x = 49; y_correct = 'XLIX'; assert(isequal(dec2rom(x),y_correct))

t = 9 4 t = 9 4 0 0 l1 = 0×0 empty char array l2 = 'IX' l3 = 'XL' l4 = 0×0 empty char array romStr = 'XLIX'

5   Pass
x = 45; y_correct = 'XLV'; assert(isequal(dec2rom(x),y_correct))

t = 5 4 t = 5 4 0 0 l1 = 0×0 empty char array l2 = 'V' l3 = 'XL' l4 = 0×0 empty char array romStr = 'XLV'

6   Pass
x = 0; y_correct = ''; assert(isempty(dec2rom(x)))

t = 0 t = 0 0 0 0 l1 = 0×0 empty char array l2 = 0×0 empty char array l3 = 0×0 empty char array l4 = 0×0 empty char array romStr = 0×0 empty char array