Cody

Solution 2190886

Submitted on 3 Apr 2020 by Martin C.
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'))

a = '3' y = '3'

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

a = '15' y = '16'

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

a = '21' y = '21'

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

a = '88' y = '99'

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

a = '111' y = '111'

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

a = '377' y = '388'

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

a = '1003' y = '1003'

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

a = '1021' y = '1021'

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

a = '1637' y = '1738'

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

a = '2511' y = '2611'

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

a = '3740' y = '3840'

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

a = '4142' y = '4142'

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

a = '4577' y = '4688'

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

a = '4771' y = '4881'

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

a = '5087' y = '6098'

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

a = '5507' y = '6608'

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

a = '5710' y = '6810'

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

a = '6016' y = '7017'

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

a = '6077' y = '7088'

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

a = '6137' y = '7138'

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

a = '6183' y = '7193'

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

a = '6186' y = '7197'

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

a = '6236' y = '7237'

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

a = '6254' y = '7264'

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

a = '6337' y = '7338'

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

a = '6370' y = '7380'

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

a = '7431' y = '8431'

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

a = '7745' y = '8846'

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

a = '8140' y = '9140'

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

a = '8205' y = '9206'

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

a = '8300' y = '9300'

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

a = '8851' y = '9961'

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

a = '10044' y = '10044'

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

a = '10081' y = '10091'

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

a = '10205' y = '10206'

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

a = '10271' y = '10281'

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

a = '10418' y = '10419'

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

a = '10578' y = '10689'

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

a = '10803' y = '10903'

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

a = '11245' y = '11246'

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

a = '11826' y = '11927'

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

a = '11864' y = '11974'

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

a = '12047' y = '12048'

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

a = '12110' y = '12110'

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

a = '12274' y = '12284'

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

a = '12503' y = '12603'

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

a = '12636' y = '12737'

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

a = '12737' y = '12838'

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

a = '13254' y = '13264'

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

a = '13541' y = '13641'

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

a = '13661' y = '13771'

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

a = '13844' y = '13944'

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

a = '14003' y = '14003'

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

a = '14062' y = '14072'

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

a = '14071' y = '14081'

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

a = '6576' y = '7687' a = '14216' y = '14217' a = '1068' y = '1079' a = '6283' y = '7293' a = '7054' y = '8064' a = '3341' y = '3341' a = '8117' y = '9118' a = '14103' y = '14103' a = '4730' y = '4830' a = '470' y = '480' a = '2121' y = '2121' a = '482' y = '492' a = '1411' y = '1411' a = '3314' y = '3314' a = '6107' y = '7108' a = '12365' y = '12376' a = '13747' y = '13848' a = '8401' y = '9401' a = '2132' y = '2132' a = '2875' y = '2986' a = '2086' y = '2097' a = '3321' y = '3321' a = '8562' y = '9672' a = '5481' y = '6491' a = '12663' y = '12773' a = '6827' y = '7928' a = '4074' y = '4084' a = '5675' y = '6786' a = '1134' y = '1134' a = '2702' y = '2802' a = '12002' y = '12002' a = '6881' y = '7991' a = '10105' y = '10106' a = '5056' y = '6067' a = '11442' y = '11442' a = '3445' y = '3446' a = '737' y = '838' a = '12188' y = '12199' a = '7188' y = '8199' a = '10257' y = '10268' a = '10358' y = '10369' a = '826' y = '927' a = '12258' y = '12269' a = '12135' y = '12136' a = '13403' y = '13403' a = '10221' y = '10221' a = '8545' y = '9646' a = '8757' y = '9868' a = '14162' y = '14172' a = '3611' y = '3711' a = '775' y = '886' a = '2166' y = '2177' a = '7881' y = '8991' a = '8510' y = '9610' a = '12033' y = '12033' a = '10283' y = '10293' a = '121' y = '121' a = '1823' y = '1923' a = '12445' y = '12446' a = '315' y = '316' a = '13865' y = '13976' a = '2582' y = '2692' a = '1154' y = '1164' a = '5111' y = '6111' a = '4722' y = '4822' a = '6838' y = '7939' a = '2205' y = '2206' a = '3130' y = '3130' a = '7148' y = '8149' a = '4320' y = '4320' a = '6676' y = '7787' a = '7732' y = '8832' a = '2344' y = '2344' a = '5505' y = '6606' a = '12380' y = '12390' a = '8816' y = '9917' a = '2746' y = '2847' a = '4820' y = '4920' a = '7767' y = '8878' a = '4262' y = '4272' a = '1735' y = '1836' a = '2455' y = '2466' a = '8110' y = '9110' a = '10850' y = '10960' a = '14241' y = '14241' a = '552' y = '662' a = '8184' y = '9194' a = '4807' y = '4908' a = '2507' y = '2608' a = '12025' y = '12026' a = '1326' y = '1327' a = '1302' y = '1302' a = '13654' y = '13764' a = '14614' y = '14714' a = '810' y = '910' a = '3554' y = '3664' a = '157' y = '168' a = '6662' y = '7772' a = '6804' y = '7904' a = '5741' y = '6841'

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

a = '1331' y = '1331' a = '1738' y = '1839' a = '2463' y = '2473' a = '3347' y = '3348' a = '4530' y = '4630' a = '6314' y = '7314' a = '11026' y = '11027'

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

a = '280' y = '290' a = '352' y = '362' a = '442' y = '442' a = '541' y = '641' a = '782' y = '892' a = '1201' y = '1201' a = '1574' y = '1684' a = '2271' y = '2281' a = '3114' y = '3114' a = '4240' 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');

Suggested Problems

More from this Author38