Skip to main content
added 8 characters in body
Source Link
user
  • 387
  • 2
  • 21
  • 68

Scala, 4141 39 bytes

n=>_.scanLeft("#"*n)((s,x)=>"" "*x+s"+_.init drop _)

Try it online!Try it online!

Uses 01 for dropping a hash on the right, 10 for dropping a hash on the left. Accepts (n)(list). Outputs a list of strings.

Input and output reversed, 35 bytes

n=>_.scanRight("#"*n)(" "*_+_.init)

Try it online!

Help! The sky's falling down!

     #
     ##
    ###
   ####
   #####
  ######
  #######
 ########
#########
##########

Scala, 41 bytes

n=>_.scanLeft("#"*n)((s,x)=>" "*x+s.init)

Try it online!

Uses 0 for dropping a hash on the right, 1 for dropping a hash on the left. Accepts (n)(list). Outputs a list of strings.

Input and output reversed, 35 bytes

n=>_.scanRight("#"*n)(" "*_+_.init)

Try it online!

Help! The sky's falling down!

     #
     ##
    ###
   ####
   #####
  ######
  #######
 ########
#########
##########

Scala, 41 39 bytes

n=>_.scanLeft("#"*n)(" "+_.init drop _)

Try it online!

Uses 1 for dropping a hash on the right, 0 for dropping a hash on the left. Accepts (n)(list). Outputs a list of strings.

Input and output reversed, 35 bytes

n=>_.scanRight("#"*n)(" "*_+_.init)

Try it online!

Help! The sky's falling down!

     #
     ##
    ###
   ####
   #####
  ######
  #######
 ########
#########
##########
Source Link
user
  • 387
  • 2
  • 21
  • 68

Scala, 41 bytes

n=>_.scanLeft("#"*n)((s,x)=>" "*x+s.init)

Try it online!

Uses 0 for dropping a hash on the right, 1 for dropping a hash on the left. Accepts (n)(list). Outputs a list of strings.

Input and output reversed, 35 bytes

n=>_.scanRight("#"*n)(" "*_+_.init)

Try it online!

Help! The sky's falling down!

     #
     ##
    ###
   ####
   #####
  ######
  #######
 ########
#########
##########