Cody

Problem 424. Snakes on a plane

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

Solution Stats

44.04% Correct | 55.96% Incorrect
Last solution submitted on Aug 31, 2016

Problem Comments

Solution Comments

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more