Given a strictly positive integer
0 isn't a valid test case), produce an approximate triangle of height
A non-programmatic process of drawing the picture
Initially we start with the base of the triangle.
So, we want to draw a triangle of a height of 5. First we know that all the
|'s align on a straight line, and there is a missing
| on every even position.
| | |
Then, we insert the
/'s onto these empty lines, where every
/ has 1 more preceding space than the next
/. The lowest
/ starts at 1 space.
| / | / |
More reference outputs + Sample program
Here's what the program should output for inputs
9. A sample program is available if you still don't understand the specification.
For those that don't see that it's a triangle: Take a look at this. Scroll the picture really quickly. You will see the two sides of a triangle.
==== 1: ==== | ==== 2: ==== / | ==== 3: ==== | / | ==== 4: ==== / | / | ==== 5: ==== | / | / | ==== 6: ==== / | / | / | ==== 7: ==== | / | / | / | ==== 8: ==== / | / | / | / | ==== 9: ==== | / | / | / | / |
- Leading/Trailing whitespace is allowed.
- The string has to be joined with newlines, outputting a string list is not allowed.