We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4fb863 commit 72a341fCopy full SHA for 72a341f
233_easy_theHouseThatASCIIBuilt/Main.hs
@@ -0,0 +1,21 @@
1
+module Main where
2
+
3
+import Data.List (transpose)
4
5
+sumHeights :: Num a => [a] -> [a] -> [a]
6
+sumHeights xs [] = xs
7
+sumHeights [] ys = ys
8
+sumHeights (x:xs) (y:ys) = x + y : sumHeights xs ys
9
10
+height :: Char -> Int
11
+height '*' = 1
12
+height _ = 0
13
14
+heights :: String -> [Int]
15
+heights = foldr1 sumHeights . map (map height) . lines
16
17
+input1 = " *\n ***\n******"
18
+input2 = " *\n***\n***\n***\n***\n***\n***"
19
+challenge1 = " **\n*** **\n******"
20
+challenge2 = "*** ***\n*** ** *** ** ***\n*** *************** ***\n*** *************** ***\n*** *************** ***\n**************************\n**************************"
21
0 commit comments