Cody

Problem 2498. Whole Number Concatenator

Solution 1162516

Submitted on 13 Apr 2017
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
a=111; b=444; N_correct=111444; assert(isequal(numcat(a,b),N_correct))

A = 111 444 B = '111 444'

Cell contents reference from a non-cell array object. Error in numcat (line 4) C=strcat(B{:}) Error in TestPoint1 (line 4) assert(isequal(numcat(a,b),N_correct))

2   Fail
a=1; b=2; c=3; d=4; f=5; N_correct=12345; assert(isequal(numcat(a,b,c,d,f),N_correct))

A = 1 2 3 4 5 B = '1 2 3 4 5'

Cell contents reference from a non-cell array object. Error in numcat (line 4) C=strcat(B{:}) Error in TestPoint2 (line 7) assert(isequal(numcat(a,b,c,d,f),N_correct))

3   Fail
a=2; b=3; c=5; d=7; f=11; g=13; h=17; k=19; l=23; m=29; n=31; N_correct=235711131719232931; assert(isequal(numcat(a,b,c,d,f,g,h,k,l,m,n),N_correct))

A = 2 3 5 7 11 13 17 19 23 29 31 B = '2 3 5 7 11 13 17 19 23 29 31'

Cell contents reference from a non-cell array object. Error in numcat (line 4) C=strcat(B{:}) Error in TestPoint3 (line 13) assert(isequal(numcat(a,b,c,d,f,g,h,k,l,m,n),N_correct))