Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 173094

Submitted on 5 Dec 2012

Incorrect

36Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
assert(same_digits(1234,4321))
p =
4321
4312
4231
4213
4123
4132
3421
3412
3241
3214
3124
3142
2341
2314
2431
2413
2143
2134
1324
1342
1234
1243
1423
1432
ans =
     1
2
Pass
 
%%
assert(same_digits(1134,4311))
p =
4311
4311
4131
4113
4113
4131
3411
3411
3141
3114
3114
3141
1341
1314
1431
1413
1143
1134
1314
1341
1134
1143
1413
1431
ans =
     1
3
Pass
 
%%
assert(same_digits(1111,1111))
p =
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
ans =
     1
4
Fail
 
%%
assert(~same_digits(11,1111))
Error: Matrix dimensions must agree.
5
Fail
 
%%
assert(~same_digits(11,1234))
Error: Matrix dimensions must agree.
6
Fail
 
%%
assert(~same_digits(1234,234))
Error: Matrix dimensions must agree.