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 Answer

Explanation
Source Link
Angs
  • 5k
  • 2
  • 17
  • 36

Haskell, 126 bytes

(#)n=maximum.map(!!n)
f l|s<-scanl1(zipWith(+))$(\a->[1-a,a])<$>l=unlines[[last$' ':['#'|elem[x,y]s]|x<-[0..0#s]]|y<-[1..1#s]]

Input as a list of zeroes and ones. Transforms number into offset by x↦[1-x,x] and calculates the partial sums. Final output is done with two nested list comprehensions.

Try it online!

Haskell, 126 bytes

(#)n=maximum.map(!!n)
f l|s<-scanl1(zipWith(+))$(\a->[1-a,a])<$>l=unlines[[last$' ':['#'|elem[x,y]s]|x<-[0..0#s]]|y<-[1..1#s]]

Input as a list of zeroes and ones

Try it online!

Haskell, 126 bytes

(#)n=maximum.map(!!n)
f l|s<-scanl1(zipWith(+))$(\a->[1-a,a])<$>l=unlines[[last$' ':['#'|elem[x,y]s]|x<-[0..0#s]]|y<-[1..1#s]]

Input as a list of zeroes and ones. Transforms number into offset by x↦[1-x,x] and calculates the partial sums. Final output is done with two nested list comprehensions.

Try it online!

Source Link
Angs
  • 5k
  • 2
  • 17
  • 36

Haskell, 126 bytes

(#)n=maximum.map(!!n)
f l|s<-scanl1(zipWith(+))$(\a->[1-a,a])<$>l=unlines[[last$' ':['#'|elem[x,y]s]|x<-[0..0#s]]|y<-[1..1#s]]

Input as a list of zeroes and ones

Try it online!

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