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 235452

Submitted on 25 Apr 2013 by Rick Rosson

Correct

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

This solution is outdated. To rescore this solution, log in.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
user_solution = fileread('hypercube_edges.m');
assert(isempty(strfind(user_solution,'regexp')));
assert(isempty(strfind(user_solution,'2str')));
assert(isempty(strfind(user_solution,'str2')));
assert(isempty(strfind(user_solution,'interp')));

                    
2
Pass
 
%%
n = 0;
E_correct = 0;
assert(isequal(hypercube_edges(n),E_correct))

                    
3
Pass
 
%%
n = 1;
E_correct = 1;
assert(isequal(hypercube_edges(n),E_correct))

                    
4
Pass
 
%%
n = 2;
E_correct = 4;
assert(isequal(hypercube_edges(n),E_correct))

                    
5
Pass
 
%%
n = 3;
E_correct = 12;
assert(isequal(hypercube_edges(n),E_correct))

                    
6
Pass
 
%%
n = 4;
E_correct = 32;
assert(isequal(hypercube_edges(n),E_correct))

                    
7
Pass
 
%%
n = 5;
E_correct = 80;
assert(isequal(hypercube_edges(n),E_correct))

                    
8
Pass
 
%%
n = 6;
E_correct = 192;
assert(isequal(hypercube_edges(n),E_correct))

                    
9
Pass
 
%%
n = 7;
E_correct = 448;
assert(isequal(hypercube_edges(n),E_correct))

                    
10
Pass
 
%%
n = 8;
E_correct = 1024;
assert(isequal(hypercube_edges(n),E_correct))

                    
11
Pass
 
%%
n = 9;
E_correct = 2304;
assert(isequal(hypercube_edges(n),E_correct))

                    
12
Pass
 
%%
n = 10;
E_correct = 5120;
assert(isequal(hypercube_edges(n),E_correct))

                    
13
Pass
 
%%
n = 11;
E_correct = 11264;
assert(isequal(hypercube_edges(n),E_correct))

                    
14
Pass
 
%%
n = 12;
E_correct = 24576;
assert(isequal(hypercube_edges(n),E_correct))

                    
15
Pass
 
%%
n = 13;
E_correct = 53248;
assert(isequal(hypercube_edges(n),E_correct))

                    
16
Pass
 
%%
n = 14;
E_correct = 114688;
assert(isequal(hypercube_edges(n),E_correct))

                    
17
Pass
 
%%
n = 15;
E_correct = 245760;
assert(isequal(hypercube_edges(n),E_correct))