Cody

Problem 43676. Count the Digits in the Box

Solution 2589742

Submitted on 20 Jun 2020
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   Fail
extras = 22222; censusIn = getDigitCensus(extras) str = string(censusIn); censusOut = histc(char([str{:}]+string(extras))-48,0:9)+1; assert(isequal(censusIn,censusOut))

test = 0 1 2 3 4 5 6 7 8 9 2 2 2 2 2

Unrecognized function or variable 'census1'. Error in getDigitCensus (line 4) while census ~= census1 Error in Test1 (line 2) censusIn = getDigitCensus(extras)

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

test = 0 1 2 3 4 5 6 7 8 9 6 3 8 0 0 5 9

Unrecognized function or variable 'census1'. Error in getDigitCensus (line 4) while census ~= census1 Error in Test2 (line 2) censusIn = getDigitCensus(extras)

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

test = 0 1 2 3 4 5 6 7 8 9 9 9 9 9 9 4 3 2

Unrecognized function or variable 'census1'. Error in getDigitCensus (line 4) while census ~= census1 Error in Test3 (line 2) censusIn = getDigitCensus(extras)

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

test = 0 1 2 3 4 5 6 7 8 9 3 4 7 8 7 9

Unrecognized function or variable 'census1'. Error in getDigitCensus (line 4) while census ~= census1 Error in Test4 (line 2) censusIn = getDigitCensus(extras)

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

test = 0 1 2 3 4 5 6 7 8 9 8 3 8 7 0 9 5 5

Unrecognized function or variable 'census1'. Error in getDigitCensus (line 4) while census ~= census1 Error in Test5 (line 2) censusIn = getDigitCensus(extras)

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

test = 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1

Unrecognized function or variable 'census1'. Error in getDigitCensus (line 4) while census ~= census1 Error in Test6 (line 2) censusIn = getDigitCensus(extras)

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!