Cody

Solution 1394128

Submitted on 26 Dec 2017 by Thomas Steffen
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' y = '3'

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

y = '15' y = '16'

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

y = '21' y = '21'

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

y = '88' y = '99'

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

y = '111' y = '111'

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

y = '377' y = '388'

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

y = '1003' y = '1003'

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

y = '1021' y = '1021'

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

y = '1637' y = '1738'

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

y = '2511' y = '2611'

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

y = '3740' y = '3840'

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

y = '4142' y = '4142'

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

y = '4577' y = '4688'

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

y = '4771' y = '4881'

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

y = '5087' y = '6098'

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

y = '5507' y = '6608'

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

y = '5710' y = '6810'

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

y = '6016' y = '7017'

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

y = '6077' y = '7088'

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

y = '6137' y = '7138'

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

y = '6183' y = '7193'

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

y = '6186' y = '7197'

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

y = '6236' y = '7237'

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

y = '6254' y = '7264'

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

y = '6337' y = '7338'

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

y = '6370' y = '7380'

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

y = '7431' y = '8431'

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

y = '7745' y = '8846'

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

y = '8140' y = '9140'

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

y = '8205' y = '9206'

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

y = '8300' y = '9300'

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

y = '8851' y = '9961'

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

y = '10044' y = '10044'

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

y = '10081' y = '10091'

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

y = '10205' y = '10206'

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

y = '10271' y = '10281'

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

y = '10418' y = '10419'

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

y = '10578' y = '10689'

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

y = '10803' y = '10903'

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

y = '11245' y = '11246'

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

y = '11826' y = '11927'

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

y = '11864' y = '11974'

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

y = '12047' y = '12048'

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

y = '12110' y = '12110'

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

y = '12274' y = '12284'

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

y = '12503' y = '12603'

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

y = '12636' y = '12737'

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

y = '12737' y = '12838'

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

y = '13254' y = '13264'

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

y = '13541' y = '13641'

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

y = '13661' y = '13771'

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

y = '13844' y = '13944'

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

y = '14003' y = '14003'

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

y = '14062' y = '14072'

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

y = '14071' y = '14081'

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

y = '1048' y = '1049' y = '12412' y = '12412' y = '2740' y = '2840' y = '13042' y = '13042' y = '12416' y = '12417' y = '7401' y = '8401' y = '6167' y = '7178' y = '12771' y = '12881' y = '4526' y = '4627' y = '2382' y = '2392' y = '12512' y = '12612' y = '12614' y = '12714' y = '14108' y = '14109' y = '2718' y = '2819' y = '6363' y = '7373' y = '12253' y = '12263' y = '4331' y = '4331' y = '11274' y = '11284' y = '8531' y = '9631' y = '13025' y = '13026' y = '8565' y = '9676' y = '2264' y = '2274' y = '520' y = '620' y = '14287' y = '14298' y = '14350' y = '14360' y = '8532' y = '9632' y = '8052' y = '9062' y = '10413' y = '10413' y = '12004' y = '12004' y = '7122' y = '8122' y = '3562' y = '3672' y = '12761' y = '12871' y = '1' y = '1' y = '7678' y = '8789' y = '12781' y = '12891' y = '11284' y = '11294' y = '12142' y = '12142' y = '3817' y = '3918' y = '6532' y = '7632' y = '52' y = '62' y = '8617' y = '9718' y = '8815' y = '9916' y = '7806' y = '8907' y = '14143' y = '14143' y = '2857' y = '2968' y = '12318' y = '12319' y = '4236' y = '4237' y = '14055' y = '14066' y = '5863' y = '6973' y = '4328' y = '4329' y = '10173' y = '10183' y = '11871' y = '11981' y = '6805' y = '7906' y = '11432' y = '11432' y = '12855' y = '12966' y = '438' y = '439' y = '14343' y = '14343' y = '1142' y = '1142' y = '2504' y = '2604' y = '13536' y = '13637' y = '10536' y = '10637' y = '14551' y = '14661' y = '11170' y = '11180' y = '13366' y = '13377' y = '212' y = '212' y = '2315' y = '2316' y = '14200' y = '14200' y = '8505' y = '9606' y = '13030' y = '13030' y = '13724' y = '13824' y = '14214' y = '14214' y = '8564' y = '9674' y = '5612' y = '6712' y = '5087' y = '6098' y = '6011' y = '7011' y = '2788' y = '2899' y = '11527' y = '11628' y = '11044' y = '11044' y = '3768' y = '3879' y = '5547' y = '6648' y = '8172' y = '9182' y = '7266' y = '8277' y = '12313' y = '12313' y = '2764' y = '2874' y = '14264' y = '14274' y = '1612' y = '1712' y = '4434' y = '4434' y = '6764' y = '7874' y = '12528' y = '12629' y = '3366' y = '3377' y = '11872' y = '11982' y = '5332' y = '6332' y = '763' y = '873' y = '5682' y = '6792' y = '7700' y = '8800' y = '14428' y = '14429' y = '2447' y = '2448' y = '4125' y = '4126' y = '4568' y = '4679' y = '81' y = '91'

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

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

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

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