\$\begingroup\$
\$\endgroup\$
5
Task
Your task is to print this exact text:
A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
Specs
- You may do it in all-lowercase instead of all-uppercase.
- Trailing newlines at the end of the triangle is allowed.
- Trailing spaces after each line is allowed.
- You must print to STDOUT instead of outputting an array of strings.
Scoring
This is code-golf. Program with lowest byte-count wins.
emanresu A
46.2k5 gold badges111 silver badges257 bronze badges
asked Aug 21, 2016 at 11:07
Leaky Nun
50.6k6 gold badges115 silver badges291 bronze badges
61 Answers 61
\$\begingroup\$
\$\endgroup\$
6
C#, 164 bytes
void a(){int i=0;Console.Write(String.Join("\n",Enumerable.Range(0,26).Select(n=>new string(Enumerable.Range(0,n*2+1).Select(m=>(char)(97+(i++)%26)).ToArray()))));}
answered Aug 21, 2016 at 12:06
downrep_nation
1,1926 silver badges12 bronze badges
-
\$\begingroup\$ I believe
"\n"is enough instead of"\r\n"\$\endgroup\$Leaky Nun– Leaky Nun2016年08月21日 12:06:27 +00:00Commented Aug 21, 2016 at 12:06 -
1\$\begingroup\$ You need to count
using System;andusing System.Linq;\$\endgroup\$LegionMammal978– LegionMammal9782016年08月21日 12:06:58 +00:00Commented Aug 21, 2016 at 12:06 -
2\$\begingroup\$ no i do not need to count them, theyre default packages. im getting sick of this remark \$\endgroup\$downrep_nation– downrep_nation2016年08月21日 12:20:16 +00:00Commented Aug 21, 2016 at 12:20
-
3\$\begingroup\$ Actually, it seems like you do need to include
using System, since otherwise I get an error aboutConsolenot existing in the current context. \$\endgroup\$anon– anon2016年08月21日 19:49:34 +00:00Commented Aug 21, 2016 at 19:49 -
1\$\begingroup\$ meta.codegolf.stackexchange.com/questions/9847/… About java but the result is the same, either fully qualify them or include the namespaces \$\endgroup\$TheLethalCoder– TheLethalCoder2016年08月22日 10:15:15 +00:00Commented Aug 22, 2016 at 10:15
Explore related questions
See similar questions with these tags.
modfunction. May make one myself if I have time. \$\endgroup\$