Cody

Problem 1748. Ripping numbers apart!

Solution 1983345

Submitted on 20 Oct 2019
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
x = 12345678 out = {[1 2 3 4 5 6 7 8]} assert(isequal(numbersRip(x),out))

x = 12345678 out = 1×1 cell array {1×8 double} s = 1 2 3 4 5 6 7 8 out = 1×1 cell array {1×8 double}

2   Fail
x = [1 23 53 1 88] out = {[1 2 3 5 3 1 8 8]} assert(isequal(numbersRip(x),out))

x = 1 23 53 1 88 out = 1×1 cell array {1×8 double} s = 0 1 2 3 5 3 0 1 8 8 s = 0 1 0 1 2 3 2 3 5 3 5 3 0 1 0 1 8 8 8 8 s = 0 1 0 1 0 1 2 3 2 3 2 3 5 3 5 3 5 3 0 1 0 1 0 1 8 8 8 8 8 8 s = 0 1 0 1 0 1 0 1 2 3 2 3 2 3 2 3 5 3 5 3 5 3 5 3 0 1 0 1 0 1 0 1 8 8 8 8 8 8 8 8 s = 0 1 0 1 0 1 0 1 0 1 2 3 2 3 2 3 2 3 2 3 5 3 5 3 5 3 5 3 5 3 0 1 0 1 0 1 0 1 0 1 8 8 8 8 8 8 8 8 8 8 out = 1×1 cell array {5×10 double}

Assertion failed.

3   Fail
x = [213 102 9 12; 11 323 34 22]; out = {[2 1 3 1 0 2 9 1 2]; [1 1 3 2 3 3 4 2 2]}; assert(isequal(numbersRip(x),out))

s = 2 1 3 1 0 2 0 0 9 0 1 2 s = 2 1 3 2 1 3 1 0 2 1 0 2 0 0 9 0 0 9 0 1 2 0 1 2 s = 2 1 3 2 1 3 2 1 3 1 0 2 1 0 2 1 0 2 0 0 9 0 0 9 0 0 9 0 1 2 0 1 2 0 1 2 s = 2 1 3 2 1 3 2 1 3 2 1 3 1 0 2 1 0 2 1 0 2 1 0 2 0 0 9 0 0 9 0 0 9 0 0 9 0 1 2 0 1 2 0 1 2 0 1 2 out = 1×1 cell array {4×12 double} s = 0 1 1 3 2 3 0 3 4 0 2 2 s = 0 1 1 0 1 1 3 2 3 3 2 3 0 3 4 0 3 4 0 2 2 0 2 2 s = 0 1 1 0 1 1 0 1 1 3 2 3 3 2 3 3 2 3 0 3 4 0 3 4 0 3 4 0 2 2 0 2 2 0 2 2 s = 0 1 1 0 1 1 0 1 1 0 1 1 3 2 3 3 2 3 3 2 3 3 2 3 0 3 4 0 3 4 0 3 4 0 3 4 0 2 2 0 2 2 0 2 2 0 2 2 out = 1×2 cell array {4×12 double} {4×12 double}

Assertion failed.

4   Fail
x = [120395; 2] out = {[1 2 0 3 9 5]; [2]} assert(isequal(numbersRip(x),out))

x = 120395 2 out = 2×1 cell array {1×6 double} {[ 2]} s = 1 2 0 3 9 5 out = 1×1 cell array {1×6 double} s = 2 out = 1×2 cell array {1×6 double} {[2]}

Assertion failed.