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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given the dimensions of a 2-d plane, create a matrix where a "snake" of ones occupies the plane from top left to bottom right.

Example:

0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0

for m=7, n=10 the m will always be odd and >5 n will be >3

42 correct solutions
56 incorrect solutions

Last solution submitted on Feb 19, 2015

1 player likes this problem

1 Comment

Stephen
on 29 Feb 2012

yeah, it depends on what your motivation is. If you want a low complexity, the puzzle is to match the test cases efficiently, but if you want low complexity and want to answer the problem, it adds a degree of difficulty. good solutions either way.

3 Comments