Draw 'W' - MATLAB Cody - MATLAB Central

Problem 55140. Draw 'W'

Difficulty:Rate
For any given n, return a matrix of height n and width 4n-3 containing a W of ones.
Example:
n=2
ans=
[1 0 1 0 1
0 1 0 1 0]
n=3
ans=
[1 0 0 0 1 0 0 0 1
0 1 0 1 0 1 0 1 0
0 0 1 0 0 0 1 0 0]

Solution Stats

56.92% Correct | 43.08% Incorrect
Last Solution submitted on Feb 11, 2025

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
2
4

Problem Recent Solvers33

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page