20
2
Create a function which given a number of lines n
, makes a bigA
.
- The horizontal bar of
bigA
must be at the middle row, or the lower of the two ifn
is even - Assume a monospace font for output
Output should be a string (or similar, eg character array) with clear linebreaks to break up the lines, and with correct whitespace for left-padding (you can assume \t to be 4 spaces). There can be any whitespace on the right.
Examples
n = 1
A
n = 2
A
AAA
n = 3
A
AAA
A A
n = 4
A
A A
AAAAA
A A
n = 5
A
A A
AAAAA
A A
A A
This is inspired by Create an "H" from smaller "H"s
May I add whitespace to the right side? Also, is trailing newline allowed? – Bubbler – 2018-03-23T01:12:54.853
@Bubbler, Any whitespace on the right side is fine, no trailing newline though – Budd – 2018-03-23T01:20:38.770
Are we allowed to return 2D character arrays instead of strings? (hint: it's usually recommended to allow any kind of output) – Olivier Grégoire – 2018-03-23T08:26:50.853
1@OlivierGrégoire Sure, as long as there is a clear break for the lines (eg an "\n" element, nested arrays) – Budd – 2018-03-23T09:00:24.633
Is an array of strings representing lines ok? Also, can I print directly to stdout? – Asone Tuhid – 2018-03-23T11:57:10.317
Yes, output is flexible as long as spacing and newlines are clearly represented somehow – Budd – 2018-03-23T12:33:23.750
Can we use another content character than "A" ? in particular, is lowercase "a" allowed ? – Ton Hospel – 2018-03-23T15:27:55.010
1@TonHospel, No, that really defeats the purporse of this – Budd – 2018-03-23T18:18:16.043
Can
____A\bA____
be used instead of____A____
?\b
stands for ASCII backspace character. – Radek – 2018-03-23T22:12:35.150