Skip to main content
3 of 3
added 145 characters in body
nimi
  • 35.9k
  • 4
  • 34
  • 99

Haskell, 52 44 bytes

f k=[[" ",s:" "]>>=(['A'..s]>>)|s<-['A'..k]]

Returns a list of lines.

Try it online!

f k=                  -- main function is f, input parameter k
  [   |s<-['A'..k]]   -- for each s from ['A'..k]
     >>=              -- map (and collect the results in a single string) the function: 
         (['A'..s]>>) --  replace each element in ['A'..s] with
    [  ,  ]           --  over the list, containing
     " "              --   a single space to get the indent
        s:" "         --   s followed by space to get the letter sequence

Edit: @jferard: saved three bytes. Thanks!

nimi
  • 35.9k
  • 4
  • 34
  • 99