Cody

Problem 44721. Seperate array to small section according to its index position

Solution 1630024

Submitted on 18 Sep 2018 by goc3
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
for n = 3 : 12 y = odd_and_even_fun(n); while length(y) ~= 1 y = cellfun(@(x)x(:)',mat2cell(cell2mat(reshape(y,2,'')),2,repelem(numel(y{1}),length(y)/2)),'uni',0); end assert(isequal(y{1},0:2^n-1)) end

nr = 1 nr = 2 nr = 1 nr = 2 nr = 4 nr = 1 nr = 2 nr = 4 nr = 8 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 32 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 32 nr = 64 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 32 nr = 64 nr = 128 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 32 nr = 64 nr = 128 nr = 256 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 32 nr = 64 nr = 128 nr = 256 nr = 512 nr = 1 nr = 2 nr = 4 nr = 8 nr = 16 nr = 32 nr = 64 nr = 128 nr = 256 nr = 512 nr = 1024