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 302971

Submitted on 13 Aug 2013 by Jan Orwat

Correct

116Size
Leading solution size is 92.
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
 
%%
dict_cell={'abcd'
'cat'
'dot'};
Achar=['abcd'
'``a`'
'dot`'];
valid=check_crisscross(Achar,dict_cell);
assert(valid==1)

                    
2
Pass
 
%%
dict_cell={'abcd'
'cat'
'dot'
'bcd'};
Achar=['abcd'
'``a`'
'dot`'];
% Need a unique bcd word
valid=check_crisscross(Achar,dict_cell);
assert(valid==0)

                    
3
Pass
 
%%
dict_cell={'abcd'
'cat'
'dot'
'acd'};
Achar=['abcd'
'c`a`'
'dot`'];
% valid matrix
valid=check_crisscross(Achar,dict_cell);
assert(valid==1)

                    
4
Pass
 
%%
dict_cell={'avalanche'
'bluejackets'
'blackhawks'
'blues'
'bruins'
'canadiens'
'canucks'
'capitals'
'coyotes'
'devils'
'ducks'
'flames'
'flyers'
'hurricanes'
'islanders'
'jets'
'kings'
'lightning'
'mapleleafs'
'oilers'
'panthers'
'penguins'
'predators'
'rangers'
'redwings'
'sabres'
'senators'
'sharks'
'stars'
'wild'};
Achar=['```````hurricanes``s'
'rangers`````o````m`e'
'e`````t```flyers`a`n'
'd`````a`````o````p`a'
'w`````r`capitals`l`t'
'i`ducks`````e````e`o'
'n```a``sabres````l`r'
'g`kings``l````oilers'
's```u``bruins````a``'
'````c````e`````p`f``'
'blackhawks``sharks``'
'``v`s``````````e````'
'``a````````i```d``p`'
'`bluejackets```a``e`'
'``a````````lightning'
'canadiens``a```o``g`'
'``c``````panthers`u`'
'``h`w``````d```s``i`'
'`devils```jets````n`'
'````l``````r``````s`'
'````d`flames````````'];
valid=check_crisscross(Achar,dict_cell);
assert(valid==1)

                    
5
Pass
 
%%
dict_cell={'avalanche'
'bluejackets'
'blackhawks'
'blues'
'bruins'
'canadiens'
'canucks'
'capitals'
'coyotes'
'devils'
'ducks'
'flames'
'flyers'
'hurricanes'
'islanders'
'jets'
'kings'
'lightning'
'mapleleafs'
'oilers'
'panthers'
'penguins'
'predators'
'rangers'
'redwings'
'sabres'
'senators'
'sharks'
'stars'
'wild'};
Achar=['```````hurricanes``s'
'rangers`````o````m`e'
'e`````t```flyers`a`n'
'd`````a`````o````p`a'
'w`````r`capitals`l`t'
'i`ducks`````e````e`o'
'n```a``sabres````l`r'
'g`kings``l````oilers'
's```u``bruins````a``'
'````c````e`````p`f``'
'blackhawks``sharks``'
'``v`s``````````e````'
'``a````````i```d``p`'
'`bluejackets```a``e`'
'``a````````lightning'
'canadiens``a```o``g`'
'``c``````panthers`u`'
'``h`w``````d```s``i`'
'`devils```jets````n`'
'````l``````r```jets`'
'````d`flames````````'];
% jets is duplicated
valid=check_crisscross(Achar,dict_cell);
assert(valid==0)

                    
6
Pass
 
%%
dict_cell={'avalanche'
'bluejackets'
'blackhawks'
'blues'
'bruins'
'canadiens'
'canucks'
'capitals'
'coyotes'
'devils'
'ducks'
'flames'
'flyers'
'hurricanes'
'islanders'
'jets'
'kings'
'lightning'
'mapleleafs'
'oilers'
'panthers'
'penguins'
'predators'
'rangers'
'redwings'
'sabres'
'senators'
'sharks'
'stars'
'wild'};
Achar=['```````hurricanes``s'
'rangers`````o````m`e'
'e`````t```flyers`a`n'
'd`````a`````o````p`a'
'w`````r`capitals`l`t'
'i`ducks`````e````e`o'
'n```a``sabres````l`r'
'g`kings``l````oilers'
's```u``bruins````a``'
'````c````e`````p`f``'
'blackhawks``sharks``'
'``v`s``````````e````'
'``a````````i```d``p`'
'`bluejackets```a``e`'
'``a````````lightning'
'canadiens``a```o``g`'
'``c``````panthers`u`'
'``h`w``````d```s``i`'
'`devils````e``````n`'
'````l``````r``````s`'
'````d`flames``jets``'];
% Non-Connected jets
valid=check_crisscross(Achar,dict_cell);
assert(valid==0)

                    
7
Pass
 
%%
dict_cell={'avalanche'
'bluejackets'
'blackhawks'
'blues'
'bruins'
'canadiens'
'canucks'
'capitals'
'coyotes'
'devils'
'ducks'
'flames'
'flyers'
'hurricanes'
'islanders'
'jets'
'kings'
'lightning'
'mapleleafs'
'oilers'
'panthers'
'penguins'
'predators'
'rangers'
'redwings'
'sabres'
'senators'
'sharks'
'stars'
'wild'};
Achar=['```````hurricanes``s'
'rangers`````o````m`e'
'e`````t```flyers`a`n'
'd`````a`````o````p`a'
'w`````r`capitals`l`t'
'i`ducks`````e````e`o'
'n```a``sabres````l`r'
'g`kings``l````oilers'
's```u``bruins````a``'
'````c````e`````p`f``'
'blackhawks``sharks``'
'``v`s``````````e````'
'``a````````i```d````'
'`bluejackets```a````'
'``a````````lightning'
'canadiens``a```o````'
'``c``````panthers```'
'``h`w``````d```s````'
'`devils```jets``````'
'````l``````r````````'
'````d`flames````````'];
% Missing penguins
valid=check_crisscross(Achar,dict_cell);
assert(valid==0)

                    
8
Pass
 
%%
dict_cell={'avalanche'
'bluejackets'
'blackhawks'
'blues'
'bruins'
'canadiens'
'canucks'
'capitals'
'coyotes'
'devils'
'ducks'
'flames'
'flyers'
'hurricanes'
'islanders'
'jets'
'kings'
'lightning'
'mapleleafs'
'oilers'
'panthers'
'penguins'
'predators'
'rangers'
'redwings'
'sabres'
'senators'
'sharks'
'stars'
'wild'};
Achar=['```````hurricanes``s'
'rangers`````o````m`e'
'e```jets``flyers`a`n'
'd`````a`````o````p`a'
'w`````r`capitals`l`t'
'i`ducks`````e````e`o'
'n```a``sabres````l`r'
'g`kings``l````oilers'
's```u``bruins````a``'
'````c````e`````p`f``'
'blackhawks``sharks``'
'``v`s``````````e````'
'``a````````i```d``p`'
'`bluejackets```a``e`'
'``a````````lightning'
'canadiens``a```o``g`'
'``c``````panthers`u`'
'``h`w``````d```s``i`'
'`devils````e``````n`'
'````l``````r``````s`'
'````d`flames````````'];
% invalid jets on row 3
valid=check_crisscross(Achar,dict_cell);
assert(valid==0)