Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Solution 235389

Submitted on 24 Apr 2013

Incorrect

23Size
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
Fail
 
%%
n = 0;
E_correct = 0;
assert(isequal(hypercube_edges(n),E_correct))
Error: N must be an array of real non-negative integers.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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