Cody

Problem 43676. Count the Digits in the Box

Solution 2589760

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 census1 = 1 1 1 1 1 1 1 1 1 1 census1 = 0 0 0 0 0 0 0 0 0 0 census = 0 1 0 0 0 0 0 0 0 0 census = 0 1 6 0 0 0 0 0 0 0 census = 0 1 6 1 0 0 0 0 0 0 census = 0 1 6 1 1 0 0 0 0 0 census = 0 1 6 1 1 1 0 0 0 0 census = 0 1 6 1 1 1 2 0 0 0 census = 0 1 6 1 1 1 2 1 0 0 census = 0 1 6 1 1 1 2 1 1 0 census = 0 1 6 1 1 1 2 1 1 1 census = 2 1 6 1 1 1 2 1 1 1 census1 = 2 1 6 1 1 1 2 1 1 1 census = 2 8 6 1 1 1 2 1 1 1 census = 2 8 8 1 1 1 2 1 1 1 census = 2 8 8 1 1 1 2 1 1 1 census = 2 8 8 1 1 1 2 1 1 1 census = 2 8 8 1 1 1 2 1 1 1 census = 2 8 8 1 1 1 1 1 1 1 census = 2 8 8 1 1 1 1 1 1 1 census = 2 8 8 1 1 1 1 1 3 1 census = 2 8 8 1 1 1 1 1 3 1 census = 1 8 8 1 1 1 1 1 3 1 censusIn = 1 8 8 1 1 1 1 1 3 1

Assertion failed.

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 census1 = 1 1 1 1 1 1 1 1 1 1 census1 = 0 0 0 0 0 0 0 0 0 0 census = 0 1 0 0 0 0 0 0 0 0 census = 0 1 1 0 0 0 0 0 0 0 census = 0 1 1 2 0 0 0 0 0 0 census = 0 1 1 2 1 0 0 0 0 0 census = 0 1 1 2 1 2 0 0 0 0 census = 0 1 1 2 1 2 2 0 0 0 census = 0 1 1 2 1 2 2 1 0 0 census = 0 1 1 2 1 2 2 1 2 0 census = 0 1 1 2 1 2 2 1 2 2 census = 4 1 1 2 1 2 2 1 2 2 census1 = 4 1 1 2 1 2 2 1 2 2 census = 4 5 1 2 1 2 2 1 2 2 census = 4 5 6 2 1 2 2 1 2 2 census = 4 5 6 2 1 2 2 1 2 2 census = 4 5 6 2 2 2 2 1 2 2 census = 4 5 6 2 2 3 2 1 2 2 census = 4 5 6 2 2 3 3 1 2 2 census = 4 5 6 2 2 3 3 1 2 2 census = 4 5 6 2 2 3 3 1 2 2 census = 4 5 6 2 2 3 3 1 2 2 census = 3 5 6 2 2 3 3 1 2 2 censusIn = 3 5 6 2 2 3 3 1 2 2

Assertion failed.

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 census1 = 1 1 1 1 1 1 1 1 1 1 census1 = 0 0 0 0 0 0 0 0 0 0 census = 0 1 0 0 0 0 0 0 0 0 census = 0 1 2 0 0 0 0 0 0 0 census = 0 1 2 2 0 0 0 0 0 0 census = 0 1 2 2 2 0 0 0 0 0 census = 0 1 2 2 2 1 0 0 0 0 census = 0 1 2 2 2 1 1 0 0 0 census = 0 1 2 2 2 1 1 1 0 0 census = 0 1 2 2 2 1 1 1 1 0 census = 0 1 2 2 2 1 1 1 1 6 census = 2 1 2 2 2 1 1 1 1 6 census1 = 2 1 2 2 2 1 1 1 1 6 census = 2 6 2 2 2 1 1 1 1 6 census = 2 6 6 2 2 1 1 1 1 6 census = 2 6 6 2 2 1 1 1 1 6 census = 2 6 6 2 2 1 1 1 1 6 census = 2 6 6 2 2 1 1 1 1 6 census = 2 6 6 2 2 1 4 1 1 6 census = 2 6 6 2 2 1 4 1 1 6 census = 2 6 6 2 2 1 4 1 1 6 census = 2 6 6 2 2 1 4 1 1 6 census = 1 6 6 2 2 1 4 1 1 6 censusIn = 1 6 6 2 2 1 4 1 1 6

Assertion failed.

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 census1 = 1 1 1 1 1 1 1 1 1 1 census1 = 0 0 0 0 0 0 0 0 0 0 census = 0 1 0 0 0 0 0 0 0 0 census = 0 1 1 0 0 0 0 0 0 0 census = 0 1 1 2 0 0 0 0 0 0 census = 0 1 1 2 2 0 0 0 0 0 census = 0 1 1 2 2 1 0 0 0 0 census = 0 1 1 2 2 1 1 0 0 0 census = 0 1 1 2 2 1 1 3 0 0 census = 0 1 1 2 2 1 1 3 2 0 census = 0 1 1 2 2 1 1 3 2 2 census = 2 1 1 2 2 1 1 3 2 2 census1 = 2 1 1 2 2 1 1 3 2 2 census = 2 5 1 2 2 1 1 3 2 2 census = 2 5 6 2 2 1 1 3 2 2 census = 2 5 6 3 2 1 1 3 2 2 census = 2 5 6 3 2 1 1 3 2 2 census = 2 5 6 3 2 2 1 3 2 2 census = 2 5 6 3 2 2 2 3 2 2 census = 2 5 6 3 2 2 2 3 2 2 census = 2 5 6 3 2 2 2 3 2 2 census = 2 5 6 3 2 2 2 3 2 2 census = 1 5 6 3 2 2 2 3 2 2 censusIn = 1 5 6 3 2 2 2 3 2 2

Assertion failed.

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 census1 = 1 1 1 1 1 1 1 1 1 1 census1 = 0 0 0 0 0 0 0 0 0 0 census = 0 1 0 0 0 0 0 0 0 0 census = 0 1 1 0 0 0 0 0 0 0 census = 0 1 1 2 0 0 0 0 0 0 census = 0 1 1 2 1 0 0 0 0 0 census = 0 1 1 2 1 3 0 0 0 0 census = 0 1 1 2 1 3 1 0 0 0 census = 0 1 1 2 1 3 1 2 0 0 census = 0 1 1 2 1 3 1 2 3 0 census = 0 1 1 2 1 3 1 2 3 2 census = 3 1 1 2 1 3 1 2 3 2 census1 = 3 1 1 2 1 3 1 2 3 2 census = 3 5 1 2 1 3 1 2 3 2 census = 3 5 4 2 1 3 1 2 3 2 census = 3 5 4 5 1 3 1 2 3 2 census = 3 5 4 5 2 3 1 2 3 2 census = 3 5 4 5 2 5 1 2 3 2 census = 3 5 4 5 2 5 1 2 3 2 census = 3 5 4 5 2 5 1 2 3 2 census = 3 5 4 5 2 5 1 2 3 2 census = 3 5 4 5 2 5 1 2 3 2 census = 2 5 4 5 2 5 1 2 3 2 censusIn = 2 5 4 5 2 5 1 2 3 2

Assertion failed.

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 census1 = 1 1 1 1 1 1 1 1 1 1 census1 = 0 0 0 0 0 0 0 0 0 0 census = 0 11 0 0 0 0 0 0 0 0 census = 0 11 1 0 0 0 0 0 0 0 census = 0 11 1 1 0 0 0 0 0 0 census = 0 11 1 1 1 0 0 0 0 0 census = 0 11 1 1 1 1 0 0 0 0 census = 0 11 1 1 1 1 1 0 0 0 census = 0 11 1 1 1 1 1 1 0 0 census = 0 11 1 1 1 1 1 1 1 0 census = 0 11 1 1 1 1 1 1 1 1 census = 2 11 1 1 1 1 1 1 1 1 census1 = 2 11 1 1 1 1 1 1 1 1 census = 2 19 1 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 2 19 2 1 1 1 1 1 1 1 census = 1 19 2 1 1 1 1 1 1 1 censusIn = 1 19 2 1 1 1 1 1 1 1

Assertion failed.

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!