You will be given a positive integer N
as input. Your task is to build a Semi-Zigzag, of N
sides, each of length N
. Since it is relatively hard to clearly describe the task, here are some examples:
N = 1
:O
N = 2
:O O O
N = 3
:O O O O O O O
N = 4
:O O O O O O O O O O O O O
N = 5
:O O O O O O O O O O O O O O O O O O O O O
N = 6
:O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O
N = 7
:O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O
As you can see, a Semi-Zigzag is made of alternating diagonal and horizontal lines, and it always begins with a top-left to bottom right diagonal line. Take note that the characters on the horizontal lines are separated by a space.
Rules
You may choose any non-whitespace character instead of
O
, it may even be inconsistent.You may output / return the result as a String or as a list of Strings, each representing one line.
You may have a trailing or leading newline.
Default Loopholes apply.
You can take input and provide output by any standard mean.
If possible, please add a testing link to your submission. I will upvote any answer that shows golfing efforts and has an explanation.
This is code-golf, so the shortest code in bytes in every language wins!