Cody

Problem 552. Cell Array Inception?

Solution 155219

Submitted on 29 Oct 2012 by Khaled Hamed
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
%% x = {{{{{{{{} 'hello'} 'world'} 'this'} 'is'} 'a'} 'string'} 'array'}; y_correct = {'hello' 'world' 'this' 'is' 'a' 'string' 'array'}; assert(isequal(unInception(x),y_correct))

ans = {1x2 cell} 'string' 'array' ans = {1x2 cell} 'a' 'string' 'array' ans = {1x2 cell} 'is' 'a' 'string' 'array' ans = Columns 1 through 5 {1x2 cell} 'this' 'is' 'a' 'string' Column 6 'array' ans = Columns 1 through 5 {1x2 cell} 'world' 'this' 'is' 'a' Columns 6 through 7 'string' 'array' ans = Columns 1 through 6 {} 'hello' 'world' 'this' 'is' 'a' Columns 7 through 8 'string' 'array' ans = Columns 1 through 6 'hello' 'world' 'this' 'is' 'a' 'string' Column 7 'array'

2   Pass
%% x = {}; y_correct = {}; assert(isequal(unInception(x),y_correct))

3   Pass
%% x = {{} ''}; y_correct = {''}; assert(isequal(unInception(x),y_correct))

ans = {''}

4   Pass
%% x = {{{{} 'hello'} ''} 'yeah'}; y_correct = {'hello' '' 'yeah'}; assert(isequal(unInception(x),y_correct))

ans = {1x2 cell} '' 'yeah' ans = {} 'hello' '' 'yeah' ans = 'hello' '' 'yeah'