Cody

Problem 1748. Ripping numbers apart!

Solution 443937

Submitted on 20 May 2014 by George Berken
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 = [1x8 double] Temp = 12345678 Temp = 1234567 Temp = 123456 Temp = 12345 Temp = 1234 Temp = 123 Temp = 12 Temp = 1 Temp = 0

2   Pass
%% 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 = [1x8 double] Temp = 1 23 53 1 88 Temp = 0 23 53 1 88 Temp = 0 2 53 1 88 Temp = 0 0 53 1 88 Temp = 0 0 5 1 88 Temp = 0 0 0 1 88 Temp = 0 0 0 0 88 Temp = 0 0 0 0 8 Temp = 0 0 0 0 0

3   Pass
%% 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))

Temp = 213 102 9 12 Temp = 21 102 9 12 Temp = 2 102 9 12 Temp = 0 102 9 12 Temp = 0 10 9 12 Temp = 0 1 9 12 Temp = 0 0 9 12 Temp = 0 0 0 12 Temp = 0 0 0 1 Temp = 0 0 0 0 Temp = 11 323 34 22 Temp = 1 323 34 22 Temp = 0 323 34 22 Temp = 0 32 34 22 Temp = 0 3 34 22 Temp = 0 0 34 22 Temp = 0 0 3 22 Temp = 0 0 0 22 Temp = 0 0 0 2 Temp = 0 0 0 0

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

x = 120395 2 out = [1x6 double] [ 2] Temp = 120395 Temp = 12039 Temp = 1203 Temp = 120 Temp = 12 Temp = 1 Temp = 0 Temp = 2 Temp = 0