Cody

Solution 1254911

Submitted on 22 Aug 2017 by Alfonso Nieto-Castanon
  • Size: 35
  • This is the leading solution.
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
extras = 22222; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

censusIn = 1 7 8 1 1 1 1 2 2 1

2   Pass
extras = 6380059; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

censusIn = 3 2 6 4 2 2 3 1 2 2

3   Pass
extras = 99999432; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

censusIn = 1 4 5 2 4 2 2 1 1 6

4   Pass
extras = 347879; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

censusIn = 1 3 4 5 3 2 1 3 2 2

5   Pass
extras = 83870955; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

censusIn = 2 2 5 4 3 4 1 2 3 2

6   Pass
extras = 1111111111; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

censusIn = 1 18 3 2 1 1 1 1 2 1

Suggested Problems

More from this Author49