Cody

Solution 1625187

Submitted on 11 Sep 2018 by Andriy Kavetsky
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
assert(isequal(regexprep(char(string(dec2missing5(3))),'^0*',''),'3'))

y = 3

2   Pass
assert(isequal(regexprep(char(string(dec2missing5(14))),'^0*',''),'16'))

y = 16

3   Pass
assert(isequal(regexprep(char(string(dec2missing5(19))),'^0*',''),'21'))

y = 21

4   Pass
assert(isequal(regexprep(char(string(dec2missing5(80))),'^0*',''),'99'))

y = 99

5   Pass
assert(isequal(regexprep(char(string(dec2missing5(91))),'^0*',''),'111'))

y = 111

6   Pass
assert(isequal(regexprep(char(string(dec2missing5(313))),'^0*',''),'388'))

y = 388

7   Pass
assert(isequal(regexprep(char(string(dec2missing5(732))),'^0*',''),'1003'))

y = 1003

8   Pass
assert(isequal(regexprep(char(string(dec2missing5(748))),'^0*',''),'1021'))

y = 1021

9   Pass
assert(isequal(regexprep(char(string(dec2missing5(1249))),'^0*',''),'1738'))

y = 1738

10   Pass
assert(isequal(regexprep(char(string(dec2missing5(1873))),'^0*',''),'2611'))

y = 2611

11   Pass
assert(isequal(regexprep(char(string(dec2missing5(2790))),'^0*',''),'3840'))

y = 3840

12   Pass
assert(isequal(regexprep(char(string(dec2missing5(3035))),'^0*',''),'4142'))

y = 4142

13   Pass
assert(isequal(regexprep(char(string(dec2missing5(3391))),'^0*',''),'4688'))

y = 4688

14   Pass
assert(isequal(regexprep(char(string(dec2missing5(3547))),'^0*',''),'4881'))

y = 4881

15   Pass
assert(isequal(regexprep(char(string(dec2missing5(3724))),'^0*',''),'6098'))

y = 6098

16   Pass
assert(isequal(regexprep(char(string(dec2missing5(4057))),'^0*',''),'6608'))

y = 6608

17   Pass
assert(isequal(regexprep(char(string(dec2missing5(4221))),'^0*',''),'6810'))

y = 6810

18   Pass
assert(isequal(regexprep(char(string(dec2missing5(4389))),'^0*',''),'7017'))

y = 7017

19   Pass
assert(isequal(regexprep(char(string(dec2missing5(4444))),'^0*',''),'7088'))

y = 7088

20   Pass
assert(isequal(regexprep(char(string(dec2missing5(4489))),'^0*',''),'7138'))

y = 7138

21   Pass
assert(isequal(regexprep(char(string(dec2missing5(4530))),'^0*',''),'7193'))

y = 7193

22   Pass
assert(isequal(regexprep(char(string(dec2missing5(4533))),'^0*',''),'7197'))

y = 7197

23   Pass
assert(isequal(regexprep(char(string(dec2missing5(4569))),'^0*',''),'7237'))

y = 7237

24   Pass
assert(isequal(regexprep(char(string(dec2missing5(4585))),'^0*',''),'7264'))

y = 7264

25   Pass
assert(isequal(regexprep(char(string(dec2missing5(4651))),'^0*',''),'7338'))

y = 7338

26   Pass
assert(isequal(regexprep(char(string(dec2missing5(4680))),'^0*',''),'7380'))

y = 7380

27   Pass
assert(isequal(regexprep(char(string(dec2missing5(5455))),'^0*',''),'8431'))

y = 8431

28   Pass
assert(isequal(regexprep(char(string(dec2missing5(5711))),'^0*',''),'8846'))

y = 8846

29   Pass
assert(isequal(regexprep(char(string(dec2missing5(5949))),'^0*',''),'9140'))

y = 9140

30   Pass
assert(isequal(regexprep(char(string(dec2missing5(5999))),'^0*',''),'9206'))

y = 9206

31   Pass
assert(isequal(regexprep(char(string(dec2missing5(6075))),'^0*',''),'9300'))

y = 9300

32   Pass
assert(isequal(regexprep(char(string(dec2missing5(6526))),'^0*',''),'9961'))

y = 9961

33   Pass
assert(isequal(regexprep(char(string(dec2missing5(6601))),'^0*',''),'10044'))

y = 10044

34   Pass
assert(isequal(regexprep(char(string(dec2missing5(6634))),'^0*',''),'10091'))

y = 10091

35   Pass
assert(isequal(regexprep(char(string(dec2missing5(6728))),'^0*',''),'10206'))

y = 10206

36   Pass
assert(isequal(regexprep(char(string(dec2missing5(6787))),'^0*',''),'10281'))

y = 10281

37   Pass
assert(isequal(regexprep(char(string(dec2missing5(6902))),'^0*',''),'10419'))

y = 10419

38   Pass
assert(isequal(regexprep(char(string(dec2missing5(7037))),'^0*',''),'10689'))

y = 10689

39   Pass
assert(isequal(regexprep(char(string(dec2missing5(7212))),'^0*',''),'10903'))

y = 10903

40   Pass
assert(isequal(regexprep(char(string(dec2missing5(7493))),'^0*',''),'11246'))

y = 11246

41   Pass
assert(isequal(regexprep(char(string(dec2missing5(7962))),'^0*',''),'11927'))

y = 11927

42   Pass
assert(isequal(regexprep(char(string(dec2missing5(7996))),'^0*',''),'11974'))

y = 11974

43   Pass
assert(isequal(regexprep(char(string(dec2missing5(8062))),'^0*',''),'12048'))

y = 12048

44   Pass
assert(isequal(regexprep(char(string(dec2missing5(8109))),'^0*',''),'12110'))

y = 12110

45   Pass
assert(isequal(regexprep(char(string(dec2missing5(8248))),'^0*',''),'12284'))

y = 12284

46   Pass
assert(isequal(regexprep(char(string(dec2missing5(8427))),'^0*',''),'12603'))

y = 12603

47   Pass
assert(isequal(regexprep(char(string(dec2missing5(8538))),'^0*',''),'12737'))

y = 12737

48   Pass
assert(isequal(regexprep(char(string(dec2missing5(8620))),'^0*',''),'12838'))

y = 12838

49   Pass
assert(isequal(regexprep(char(string(dec2missing5(8959))),'^0*',''),'13264'))

y = 13264

50   Pass
assert(isequal(regexprep(char(string(dec2missing5(9190))),'^0*',''),'13641'))

y = 13641

51   Pass
assert(isequal(regexprep(char(string(dec2missing5(9289))),'^0*',''),'13771'))

y = 13771

52   Pass
assert(isequal(regexprep(char(string(dec2missing5(9436))),'^0*',''),'13944'))

y = 13944

53   Pass
assert(isequal(regexprep(char(string(dec2missing5(9480))),'^0*',''),'14003'))

y = 14003

54   Pass
assert(isequal(regexprep(char(string(dec2missing5(9533))),'^0*',''),'14072'))

y = 14072

55   Pass
assert(isequal(regexprep(char(string(dec2missing5(9541))),'^0*',''),'14081'))

y = 14081

56   Pass
for n=1:100, assert(all(char(string(dec2missing5(randi(10000))))~='5')); end

y = 234 y = 7718 y = 1746 y = 13247 y = 4793 y = 7277 y = 11079 y = 11697 y = 8376 y = 4400 y = 7378 y = 1484 y = 13214 y = 3062 y = 9319 y = 9630 y = 9367 y = 12291 y = 3117 y = 630 y = 686 y = 2034 y = 10923 y = 9411 y = 3114 y = 1263 y = 13017 y = 11991 y = 2869 y = 1762 y = 8378 y = 9001 y = 9398 y = 918 y = 2622 y = 9047 y = 11944 y = 6932 y = 8722 y = 14242 y = 7047 y = 3748 y = 12911 y = 11849 y = 4041 y = 11897 y = 13007 y = 647 y = 216 y = 11280 y = 12949 y = 14612 y = 4912 y = 12390 y = 483 y = 1246 y = 4072 y = 14707 y = 2119 y = 10610 y = 97 y = 473 y = 6637 y = 12974 y = 14493 y = 10683 y = 10960 y = 2824 y = 1932 y = 647 y = 14497 y = 13778 y = 10162 y = 10991 y = 3639 y = 1914 y = 4961 y = 11794 y = 2113 y = 8669 y = 3219 y = 7779 y = 12193 y = 11434 y = 8480 y = 6098 y = 2120 y = 9828 y = 13642 y = 7266 y = 809 y = 6946 y = 8498 y = 1371 y = 7263 y = 9799 y = 8620 y = 9781 y = 14289 y = 7337

57   Pass
x='1000'; for n=1:7, x=char(string(dec2missing5(str2double(x)))); end; assert(isequal(regexprep(x,'^0*',''),'11027'));

y = 1331 y = 1839 y = 2473 y = 3348 y = 4630 y = 7314 y = 11027

58   Pass
x='234'; for n=1:10, x=char(string(dec2missing5(str2double(x)))); end; assert(isequal(regexprep(x,'^0*',''),'4240'));

y = 290 y = 362 y = 442 y = 641 y = 892 y = 1201 y = 1684 y = 2281 y = 3114 y = 4240

59   Pass
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13944,14003,14072,14081]),regexp(fileread('dec2missing5.m'),'((\s*[\+\-\*\/]\s*)?[\d\.])+','match'))),'please do not use look-up table solutions');