Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

3 of 3
added 145 characters in body
nimi
  • 36k
  • 4
  • 35
  • 100

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
  • 36k
  • 4
  • 35
  • 100

AltStyle によって変換されたページ (->オリジナル) /