We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
UPDATE: Finally, figured out how to print a [[Char]] in the correct format with Haskell...
-- PRINT with FORMAT two::[Int]->[String]twom=map(show)mthree::[[Int]]->[[String]]threem=map(two)mmain=dom<-readLn::IOInt--send (tri m) -- print tri to row mmapM_(putStrLn.intercalate" "$)(three(trim))
Where (tri m) produces [["1"], ["1", "1"], ["1", "2", "1"], ["1", "3", "3", "1"]]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pascal's Triangle
You are viewing a single comment's thread. Return to all comments →
UPDATE: Finally, figured out how to print a [[Char]] in the correct format with Haskell...
Where (tri m) produces [["1"], ["1", "1"], ["1", "2", "1"], ["1", "3", "3", "1"]]