Cody

Solution 1388054

Submitted on 20 Dec 2017 by FruitsLord
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'))

Elapsed time is 0.001170 seconds.

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

Elapsed time is 0.002985 seconds.

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

Elapsed time is 0.000220 seconds.

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

Elapsed time is 0.000473 seconds.

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

Elapsed time is 0.000512 seconds.

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

Elapsed time is 0.000115 seconds.

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

Elapsed time is 0.000445 seconds.

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

Elapsed time is 0.000313 seconds.

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

Elapsed time is 0.000592 seconds.

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

Elapsed time is 0.000683 seconds.

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

Elapsed time is 0.001010 seconds.

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

Elapsed time is 0.001056 seconds.

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

Elapsed time is 0.001193 seconds.

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

Elapsed time is 0.001077 seconds.

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

Elapsed time is 0.001466 seconds.

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

Elapsed time is 0.001673 seconds.

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

Elapsed time is 0.001721 seconds.

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

Elapsed time is 0.001678 seconds.

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

Elapsed time is 0.001702 seconds.

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

Elapsed time is 0.001662 seconds.

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

Elapsed time is 0.001584 seconds.

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

Elapsed time is 0.001694 seconds.

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

Elapsed time is 0.001657 seconds.

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

Elapsed time is 0.001633 seconds.

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

Elapsed time is 0.001739 seconds.

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

Elapsed time is 0.001761 seconds.

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

Elapsed time is 0.002095 seconds.

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

Elapsed time is 0.002143 seconds.

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

Elapsed time is 0.002323 seconds.

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

Elapsed time is 0.002114 seconds.

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

Elapsed time is 0.002266 seconds.

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

Elapsed time is 0.002338 seconds.

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

Elapsed time is 0.002351 seconds.

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

Elapsed time is 0.002387 seconds.

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

Elapsed time is 0.002725 seconds.

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

Elapsed time is 0.002499 seconds.

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

Elapsed time is 0.002524 seconds.

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

Elapsed time is 0.002627 seconds.

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

Elapsed time is 0.002597 seconds.

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

Elapsed time is 0.003141 seconds.

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

Elapsed time is 0.003255 seconds.

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

Elapsed time is 0.002836 seconds.

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

Elapsed time is 0.002752 seconds.

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

Elapsed time is 0.002918 seconds.

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

Elapsed time is 0.003248 seconds.

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

Elapsed time is 0.003055 seconds.

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

Elapsed time is 0.003239 seconds.

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

Elapsed time is 0.003274 seconds.

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

Elapsed time is 0.003515 seconds.

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

Elapsed time is 0.003403 seconds.

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

Elapsed time is 0.003395 seconds.

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

Elapsed time is 0.003604 seconds.

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

Elapsed time is 0.003765 seconds.

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

Elapsed time is 0.003881 seconds.

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

Elapsed time is 0.003416 seconds.

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

Elapsed time is 0.001402 seconds. Elapsed time is 0.001718 seconds. Elapsed time is 0.002760 seconds. Elapsed time is 0.002899 seconds. Elapsed time is 0.001565 seconds. Elapsed time is 0.001145 seconds. Elapsed time is 0.002461 seconds. Elapsed time is 0.001052 seconds. Elapsed time is 0.002475 seconds. Elapsed time is 0.003501 seconds. Elapsed time is 0.000100 seconds. Elapsed time is 0.003018 seconds. Elapsed time is 0.002554 seconds. Elapsed time is 0.002516 seconds. Elapsed time is 0.000860 seconds. Elapsed time is 0.000020 seconds. Elapsed time is 0.002975 seconds. Elapsed time is 0.002204 seconds. Elapsed time is 0.003596 seconds. Elapsed time is 0.000456 seconds. Elapsed time is 0.000355 seconds. Elapsed time is 0.003205 seconds. Elapsed time is 0.001765 seconds. Elapsed time is 0.000023 seconds. Elapsed time is 0.000884 seconds. Elapsed time is 0.001644 seconds. Elapsed time is 0.002905 seconds. Elapsed time is 0.000049 seconds. Elapsed time is 0.000225 seconds. Elapsed time is 0.002808 seconds. Elapsed time is 0.001346 seconds. Elapsed time is 0.000711 seconds. Elapsed time is 0.003375 seconds. Elapsed time is 0.001155 seconds. Elapsed time is 0.000078 seconds. Elapsed time is 0.002362 seconds. Elapsed time is 0.002649 seconds. Elapsed time is 0.000046 seconds. Elapsed time is 0.002462 seconds. Elapsed time is 0.003206 seconds. Elapsed time is 0.002802 seconds. Elapsed time is 0.001169 seconds. Elapsed time is 0.002665 seconds. Elapsed time is 0.000267 seconds. Elapsed time is 0.001899 seconds. Elapsed time is 0.000367 seconds. Elapsed time is 0.000403 seconds. Elapsed time is 0.000437 seconds. Elapsed time is 0.002211 seconds. Elapsed time is 0.003852 seconds. Elapsed time is 0.000437 seconds. Elapsed time is 0.000190 seconds. Elapsed time is 0.003089 seconds. Elapsed time is 0.002834 seconds. Elapsed time is 0.002072 seconds. Elapsed time is 0.000569 seconds. Elapsed time is 0.002085 seconds. Elapsed time is 0.004069 seconds. Elapsed time is 0.002301 seconds. Elapsed time is 0.000222 seconds. Elapsed time is 0.000970 seconds. Elapsed time is 0.002096 seconds. Elapsed time is 0.000592 seconds. Elapsed time is 0.002518 seconds. Elapsed time is 0.000632 seconds. Elapsed time is 0.001795 seconds. Elapsed time is 0.000069 seconds. Elapsed time is 0.002859 seconds. Elapsed time is 0.001670 seconds. Elapsed time is 0.000134 seconds. Elapsed time is 0.001588 seconds. Elapsed time is 0.002398 seconds. Elapsed time is 0.000272 seconds. Elapsed time is 0.003474 seconds. Elapsed time is 0.003358 seconds. Elapsed time is 0.002892 seconds. Elapsed time is 0.001633 seconds. Elapsed time is 0.000593 seconds. Elapsed time is 0.001815 seconds. Elapsed time is 0.001813 seconds. Elapsed time is 0.001184 seconds. Elapsed time is 0.001687 seconds. Elapsed time is 0.003402 seconds. Elapsed time is 0.002081 seconds. Elapsed time is 0.003604 seconds. Elapsed time is 0.002832 seconds. Elapsed time is 0.001718 seconds. Elapsed time is 0.002879 seconds. Elapsed time is 0.002113 seconds. Elapsed time is 0.000447 seconds. Elapsed time is 0.000067 seconds. Elapsed time is 0.000355 seconds. Elapsed time is 0.000493 seconds. Elapsed time is 0.003904 seconds. Elapsed time is 0.001385 seconds. Elapsed time is 0.001403 seconds. Elapsed time is 0.002991 seconds. Elapsed time is 0.000403 seconds. Elapsed time is 0.003277 seconds. Elapsed time is 0.002824 seconds.

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

Elapsed time is 0.000269 seconds. Elapsed time is 0.000374 seconds. Elapsed time is 0.000550 seconds. Elapsed time is 0.000809 seconds. Elapsed time is 0.001095 seconds. Elapsed time is 0.001660 seconds. Elapsed time is 0.002556 seconds.

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

Elapsed time is 0.000066 seconds. Elapsed time is 0.000077 seconds. Elapsed time is 0.000095 seconds. Elapsed time is 0.000127 seconds. Elapsed time is 0.000201 seconds. Elapsed time is 0.000232 seconds. Elapsed time is 0.000336 seconds. Elapsed time is 0.000472 seconds. Elapsed time is 0.000649 seconds. Elapsed time is 0.000952 seconds.

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');